Sample Code

function CallAPI($method, $url, $data = false)
{
$curl = curl_init();
switch ($method)
{
case "POST": curl_setopt($curl, CURLOPT_POST, 1);
if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT": curl_setopt($curl, CURLOPT_PUT, 1);
break;
default: if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($curl);
}
?>

Calling :
$data[’apikey’]=”asdasdasdasd”;
print_r(CallAPI("POST","http://tnmails.com/api/getCampaigns", $data));
Tags: Sample Code
In case you are facing some issue with this content feel free to contact us at support@technetto.com or call us at 9958076757