0
I am trying to insert a lead into ZOHO CRM using php curl.Unable to create a lead dynamically.I am using auth token to send request to ho api with xml data.Not able to get the error to fix and insert lead.Please suggest the fix.Below is entire code i am running

I am getting error as 4600.Unable to process your request. Please verify whether you have entered proper method name,parameter and parameter values.

XMLdata is an xml with dynamic data passed with data to be inserted as the lead.

$url = "https://crm.zoho.com/crm/private/xml/Leads/insertRecords?authtoken=195509dec8d5fae8082083bbe2fc04c5&scope=crmapi&newFormat=1&version=2&duplicateCheck=2";
$post=array("newFormat"=>'1',"xmlData"=>$xmlData);


$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);
Nitin
  • 1
  • 1
  • 6

2 Answers2

2

The error code 4600 means that you are trying to send a lead with invalid parameters, can be values or fields name,

Incorrect API parameter or API parameter value. Also check the method name and/or spelling errors in the API url.

mostly values... so just verify the values that you are sending inside your variable $xmlData, verify that is a valid XML, if you want you can use this wrapper, for interact with zoho, I use it...

Zoho CRM library for PHP 5.3+

Hope that help :)

user2976753
  • 935
  • 11
  • 24
1
<?php
$xml = 
        '<?xml version="1.0" encoding="UTF-8"?>
        <Leads>
        <row no="1">
        <FL val="First Name">Digant</FL>
        <FL val="Last Name">Shah1</FL>
        <FL val="Email">digant.shah91@gmail.com</FL>
        <FL val="Department">php</FL>
        <FL val="Phone">999999999</FL>
        <FL val="Fax">99999999</FL>
        <FL val="Mobile">99989989</FL>
        <FL val="Assistant">none</FL>
        </row>
        </Leads>';
$auth="*******************";
    $url ="https://crm.zoho.com/crm/private/xml/Leads/insertRecords";
    $query="authtoken=".$auth."&scope=crmapi&newFormat=1&xmlData=".$xml;
    $ch = curl_init();
    /* set url to send post request */
    curl_setopt($ch, CURLOPT_URL, $url);
    /* allow redirects */
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    /* return a response into a variable */
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    /* times out after 30s */
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    /* set POST method */
    curl_setopt($ch, CURLOPT_POST, 1);
    /* add POST fields parameters */
    curl_setopt($ch, CURLOPT_POSTFIELDS, $query);// Set the request as a POST FIELD for curl.

    //Execute cUrl session
    $response = curl_exec($ch);
    curl_close($ch);
    echo $response;




?>
Digant Shah
  • 163
  • 1
  • 1
  • 8