2013-06-24 51 views
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.無法處理您的請求。請確認您是否輸入了正確的方法名稱,參數和參數值。在ZOHO CRM中插入鉛使用PHP cURL

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

回答

2

錯誤代碼4600意味着你要發送一個領先無效的參數,可值或字段名稱,

不正確的API參數或API的參數值。還請檢查API網址中名稱和/或拼寫錯誤的方法 。

大多值...所以只是驗證您是否您的變量$xmlData內發送的值,驗證是有效的XML,如果你願意,你可以使用此包裝,與ZOHO互動,我用它。 ..

Zoho CRM library for PHP 5.3+

希望能夠幫助:)

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">[email protected]</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; 




?>