Jibran
Jibran

Reputation: 99

Curl Installation

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"=> "[email protected]"
                    );      
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);
}

Upvotes: 0

Views: 49

Answers (1)

user4628565
user4628565

Reputation:

search php.ini file for

‘;extension=php_curl.dll’

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

Upvotes: 1

Related Questions