ZOHO CRM API – Insert Lead

Posted: August 29, 2012 in PHP
Tags: , ,

<?
$xmlData = '<Leads>
<row no="1">
<FL val="Lead Owner">'.$email.'</FL>
<FL val="First Name">'.$firstName.'</FL>
<FL val="Last Name">'.$lastName.'</FL>
<FL val="Email">'.$email.'</FL>
<FL val="Phone">'.$phone.'</FL>
<FL val="Description">Insert ZOHO Lead</FL>
</row>
</Leads>';
$url = "https://crm.zoho.com/crm/private/xml/Leads/insertRecords?authtoken=".ZOHO_TOKEN."&scope=crmapi";
$post=array("newFormat"=>'1',"xmlData"=>$xmlData);
//================= start curl ===================
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
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,$post);
$result = curl_exec($ch);
curl_close($ch);
//================= end curl ===================
echo '<pre>';
print_r($result);
exit;
?>

Advertisements
Comments
  1. Johnluchy says:

    Hello, very nice blog post. Thanks for great posting.

  2. Rupam says:

    Hi….

    Its a very usefull code for integrating the php and zoho.but i have one query thats is i want a zoho crm data in my local DB i.e MySQL.means when i create a Leads in ZOHO CRM at the same time the same record also create in MySQL DB.so how to achieve this functionality???

    Regards,
    ZOHO Fun…!!!

  3. Andre Piper says:

    Thank you… the curl section of the code helped me alot… i couldn’t get it to work on my previous code…

  4. Ravi Sah says:

    Its good for leaning zoho crm insert record in a lead .

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s