Http 500 error while inserting records

Http 500 error while inserting records

Hi  all

I am trying to insert the lead and contact records to Zoho CRM but i am getting Http 1.1/ 500 error. I dont know where am i going wrong.

<?php
$api_key = '*******************************';
$ticket='81d9e7f7901a0a6821e12695ee8688a1';   
$zoho_url = 'http://crm.zoho.com/crm/private/xml/Leads/insertRecords';
 
$xml ='<?xml version="1.0" encoding="UTF-8"?><Leads><row no="1"><FL val="Lead Source">paris hotels</FL><FL val="First Name">contacto 1</FL><FL val="Last Name">apellido</FL><FL val="Email">testing@testing.com</FL><FL val="Phone">1234567890</FL><FL val="Home Phone">0987654321</FL><FL val="Other Phone">1212211212</FL><FL val="Fax">02927272626</FL><FL val="Mobile">292827622</FL></row></Leads>';
 
// Create headers
$header[] = "Host: ".$zoho_url;
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($xml) . "\r\n";
$header[] = $xml;

//Create Data
$data = array('newFormat'=>1,'apikey'=>$api_key,'ticket'=>$ticket,'xmlData'=>$xml);
 
$ch = curl_init($zoho_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_URL, $zoho_url);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($ch, CURLOPT_HEADER, $header);
 
//make the request
$result = curl_exec($ch);

print_r($result);
//echo $error;

?>

please reply me asap. and help me in this regard