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);
case "PUT": curl_setopt($curl, CURLOPT_PUT, 1);
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 :
print_r(CallAPI("POST","", $data));
Tags: Sample Code
In case you are facing some issue with this content feel free to contact us at or call us at 9958076757