【问题标题】:Insert Lead in ZOHO CRM usinh PHP cURL使用 PHP cURL 在 ZOHO CRM 中插入潜在客户
【发布时间】:2013-06-24 10:40:44
【问题描述】:
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);

【问题讨论】:

    标签: curl zoho


    【解决方案1】:

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

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

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

    Zoho CRM library for PHP 5.3+

    希望有所帮助:)

    【讨论】:

    • 2020 年,现在有一个 newer way 来处理这个问题。
    【解决方案2】:
    <?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;
    
    
    
    
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-06
      • 2012-04-15
      • 2017-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多