HTTP POST Using PHP cURL
In this tutorial we have a simple example on how to use the cURL to POST data to a website.
[wpdm_file id=5]
PHP Code
Simple PHP Code
//extract data from the post extract($_POST); //set POST variables $url = 'http://www.example.com/get-post.php'; $fields = array( 'l_Name'=>urlencode($l_Name), 'f_Name'=>urlencode($f_Name), 'company'=>urlencode($company), 'age'=>urlencode($age), 'email'=>urlencode($email) ); foreach($fields as $key=>$value) { $string_Fields .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch);
Tutorial Categories:
hi, do you know how to preview html in pdf
can you please create an video on cURL!! Please create a video on cURL introduce it and show its difference commands and uses
That page not available please try any other page.
That is the one used in the tutorial
Now changed it to dummy url in tutorial please try some real page.