我与 zohoCRM 进行了有效的 PHP 集成,以将潜在客户从 Web 表单插入系统。突然,这些表单不再起作用,并且 Zoho 错误消息中没有有用的调试信息。这是代码:
$xml = '<?xml version="1.0" encoding="UTF-8"?>'; // same error with or without this line
$xml .= '<Leads>';
$xml .= '<row no="1">';
if(isset($fname)) $xml .= '<FL val="First Name">'.$fname.'</FL>';
if(isset($lname)) $xml .= '<FL val="Last Name">'.$lname.'</FL>';
if(isset($post['sender_email'])) $xml .= '<FL val="Email">'.$post['sender_email'].'</FL>';
$xml .= '<FL val="Lead Source">Web Research</FL>';
if(isset($phone)) $xml .= '<FL val="Phone">'.$phone.'</FL>';
$xml .= '<FL val="Description">'.$comments.'</FL>';
$xml .= '</row>';
$xml .= '</Leads>';
/*
var_dump($xml) returns:
<?xml version="1.0" encoding="UTF-8"?><Leads><row no="1"><FL val="First Name">Joe</FL><FL val="Last Name">Smith</FL><FL val="Email">smith@example.com</FL><FL val="Lead Source">Web Research</FL><FL val="Phone">123-456-5678</FL><FL val="Description">My comments</FL></row></Leads>
*/
$url ="https://crm.zoho.com/crm/private/xml/Leads/insertRecords";
$query="authtoken=validtoken&scope=crmapi&newFormat=1&xmlData=".$xml;
$ch = curl_init();
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, $query);// Set the request as a POST FIELD for curl.
//Execute cUrl session
$response = curl_exec($ch);
curl_close($ch);
var_dump( $response );
// returns 4600 Unable to process your request. Please verify if the name and value is appropriate for the "xmlData" parameter.
似乎无论我尝试什么(并且我在一天的大部分时间里都尝试了很多),除了这个无用的4600
错误之外,我什么也得不到。有没有人遇到过这个?