hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
ubuntu
/
bmse.net
/
Upload FileeE
HOME
<?php //echo "yeas"; ini_set('display_errors','on'); //echo "yees"; //echo "yes"; function callAPIP($method, $url, $data){ $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_CUSTOMREQUEST, "PUT"); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // OPTIONS: curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/x-www-form-urlencoded' )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // EXECUTE: $resultp = curl_exec($curl); if(!$resultp){die("Connection Failure");} curl_close($curl); return $resultp; } $jayParsedAryp = "refresh_token=1000.0ddff0d0a69d23e3ffa47873a5f11676.cfdd57fa4011ff864ca9a027e8156d1a&client_id=1000.93GQ9BZVE7GZ9JDQUM5WXZWPAB0API&client_secret=3feec69c146e80d0c39afe5e35e39875985bd85060&grant_type=refresh_token"; $make_callp = callAPIP('POST', 'https://accounts.zoho.com/oauth/v2/token?', ($jayParsedAryp)); $responsep = json_decode($make_callp, true); echo "<pre>"; print_r($responsep); echo "</pre>"; echo $responsep['access_token']; function callAPI($method, $url, $data, $token){ $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_CUSTOMREQUEST, "PUT"); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // OPTIONS: curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( // 'Authorization:Zoho-oauthtoken 1000.499f846ea0e2ad3eb94b3a8b4c85a181.cd8350b10213495ff60583bf22377060', 'Authorization:Zoho-oauthtoken '.$token.'', 'Content-Type: application/json' )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // EXECUTE: $result = curl_exec($curl); if(!$result){die("Connection Failure");} curl_close($curl); return $result; } /* $jayParsedAry = [ "data" => [ [ "Company" => "BMSE", "Last_Name" => "Mamidala1", "First_Name" => "Bhoom1", "Email" => "Bhoom1@bmse.net", "State" => "Oregan" ] ], "trigger" => [ "approval", "workflow", "blueprint" ] ]; */ $jayParsedAry = array( "data" => array( array( "Company" => "Test6 Company", "Last_Name" => "Mamidala", "First_Name" => "Bhoom6", "Email" => "Bhoom6@bmse.net", "State" => "Oregan" )), "trigger" =>array( "approval", "workflow", "blueprint" ) ); $make_call = callAPI('POST', 'https://www.zohoapis.com/crm/v2/Leads', json_encode($jayParsedAry), $responsep['access_token']); $response = json_decode($make_call, true); echo "<pre>"; print_r($response); echo "</pre>"; ?>