Hello ,
I'am trying to fetch records with php but i failed and the problem is nothings appear on my console please help me guys .
Added to that i had also try to create post request and always console blank and nothing happend.
# This is my code
Request fetch
<?php
header("Content-type: application/xml");
$token="my api token value";
$url = "
https://crm.zoho.com/crm/private/xml/Contacts/getRecords";
$param= "authtoken=".$token."&scope=crmapi";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
return $result;
?>
Request POST
<?php
//Initialize connection
$ch = curl_init('
https://crm.zoho.com/crm/private/xml/Prospects/insertRecords?');
curl_setopt($ch, CURLOPT_VERBOSE, 1);//standard i/o streams
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);// Turn off the server and peer verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//Set to return data to string ($response)
curl_setopt($ch, CURLOPT_POST, 1);//Regular post
//Set post fields
//this script is being proccessed by a form so I also put all of my $_POST['name'] variable here to be
//used in the $xmlData variable below
$authtoken = "my api token value";
$xmlData = "<Leads><row no='1'>
<FL val='Lead Source'>Web Download</FL>
<FL val='Company'>Your Company3</FL>
<FL val='First Name'>Hannah3</FL>
<FL val='Last Name'>Smith3</FL>
<FL val='Email'>
testing3@testing.com</FL>
<FL val='Title'>Manager3</FL>
<FL val='Phone'>1234567890</FL>
<FL val='Home Phone'>0987654321</FL>
<FL val='Other Phone'>1212211212</FL>
<FL val='Fax'>02927272626</FL>
<FL val='Mobile'>292827622</FL>
</row></Leads>";
$xmlData2 = urlencode($xmlData);
$query = "newFormat=1&authtoken={$authtoken}&scope=crmapi&xmlData={$xmlData2}";
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);// Set the request as a POST FIELD for curl.
echo $query;
//Execute cUrl session
$response = curl_exec($ch);
echo $response;
curl_close($ch);
?>
Thanks .