views:

31

answers:

0

when i execute this code replacing the variable with dummy data then it is working but when i write the code in this way it's not working how can i solve?

$xmldata ='https://crm.zoho.com/crm/private/xml/Contacts/insertRecords?apikey='.$api.'&ticket='.$ticket.'&newFormat=1&xmlData=
<Contacts>
<row no="1">
<FL val="Salutation">'.$salutation.'</FL>
<FL val="First Name">'.$first_name.'</FL>
<FL val="Last Name">'.$last_name.'</FL>
<FL val="Email">'.$email_address.'</FL>
<FL val="Phone">'.$phone.'</FL>
<FL val="Password">'.$password.'</FL>
</row>
</Contacts>';

$ch1 = curl_init(); 
curl_setopt($ch1, CURLOPT_URL,$xmldata);
$indata = curl_getinfo($ch1);
$new_url = $indata['url'];
curl_close($ch1);

$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL,$new_url); 
curl_setopt($ch2, CURLOPT_POST, true);
curl_setopt($ch2,CURLOPT_SSL_VERIFYPEER,0);
curl_exec($ch2);
echo curl_error($ch2);

and the error is

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/crm/private/xml/Contacts/insertRecords"><error><code>4500</code><message>Problem occured while processing the request</message></error></response>

how can i fix this? please reply me Madan