0

I post a question and some one informed me to user curl function. I dig in detail and got confuse. Do I have to install curl and then I can use it my curl function to pass value is ?

post_to_url("https://www.msgapp.com/RESTPostForm.aspx", $data); 
$data= array(
                "Customer"=> "ch",
                "cke"=>"1",
                "ownerid"=> "6",
                "overwrite"=>"0",
                "TriggerID"=> "1950",
                "PushExternal"=> "1",
                "City"=> "London",
                "FirstName"=>"Test",
                "LastName"=>"User",
                "Email"=> "jibran@abc.com"
                    );      
function post_to_url($url, $data) {
   $fields = '';
   foreach($data as $key => $value) { 
      $fields .= $key . '=' . $value . '&'; 
   }
   rtrim($fields, '&');

   $post = curl_init();

   curl_setopt($post, CURLOPT_URL, $url);
   curl_setopt($post, CURLOPT_POST, count($data));
   curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
   curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);

   $result = curl_exec($post);

   curl_close($post);
}
Jibran
  • 99
  • 1
  • 1
  • 8
  • 1
    yes, generally speaking the current world order requires software must be installed before it is used. similar question asked on how to do that (all over the place if this isnt right for you) http://stackoverflow.com/questions/1347146/how-to-enable-curl-in-php-xampp – hubson bropa Jun 25 '15 at 15:09
  • Thanks for your comment, I think I said in my question I have been suggested by some one to use curl and I am new to this. You can explain me in a simplistic and easy way – Jibran Jun 25 '15 at 15:35

1 Answers1

1

search php.ini file for

‘;extension=php_curl.dll’

and remove the semi-colon in front, then you can run curl function