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

我收到 4600 错误。无法处理您的请求。请验证您是否输入了正确的方法名称、参数和参数值。

XMLdata 是一个带有动态数据的 xml,它以要插入的数据为前导。

$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);
4

2 回答 2

2

错误代码4600表示您正在尝试发送带有无效参数的潜在客户,可以是值或字段名称,

API 参数或 API 参数值不正确。还要检查 API url 中的方法名称和/或拼写错误。

主要是值...所以只需验证您在变量中发送的值$xmlData,验证这是一个有效的 XML,如果您愿意,您可以使用此包装器,与 zoho 交互,我使用它...

适用于 PHP 5.3+ 的 Zoho CRM 库

希望有所帮助:)

于 2014-02-20T21:32:48.543 回答
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;




?>
于 2014-09-05T05:57:01.507 回答