Php Forward Post Variables To Other Page
I have html form and I have to submit that form on same page where's that form, add POST variable and then all variables pass to next page. I tried this:
Solution 3:
you need to use cURL for this.
$fields_string = "name=".$_POST['name']."&email=.$_POST['email'];
$url = "the website you want to post to";
$cx = curl_init();
curl_setopt($cx, CURLOPT_URL,$url);
curl_setopt($cx, CURLOPT_POST, true);
curl_setopt($cx, CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($cx, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($cx, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($cx, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cx, CURLOPT_FOLLOWLOCATION, FALSE);
$init_response = curl_exec($cx);
curl_close($cx);
Post a Comment for "Php Forward Post Variables To Other Page"