Post Requests with cURL

<?php

   //open connection
   $ch = curl_init();

   //set the url
   curl_setopt($ch,CURLOPT_URL, $url);

   //set the number of POST vars
   curl_setopt($ch,CURLOPT_POST, count($fields));

   //set POST data
   curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

   //execute post
   $result = curl_exec($ch);

   //close connection
   curl_close($ch);

?>

Do you find this helpful?

Related articles