Wednesday, 9 August 2017

Using Curl


$ch = curl_init();        // initialize curl
curl_setopt($ch, CURLOPT_URL,"http://mobilemonitoring.compliantcampaign.com/api/user/create");        //setting url
curl_setopt($ch, CURLOPT_POST, 1);
$vars=array("name"=>"testrah","password"=>"123456");    //setting post variables
curl_setopt($ch, CURLOPT_POSTFIELDS,$vars);  //Posting Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   

$headers = ['Auth: 2309usdfoasep0qu234asdf1'];    // setting authentication in header

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);    // setting authentication in header in curl   

$server_output = curl_exec ($ch);    // executing curl

curl_close ($ch);        // closing curl;

print  $server_output ;


banner
Previous Post
Next Post

0 comments: