hi i am using php api to create leads, but i need to create lead with custom layout, i have searched in google and found the below script but i won't work. Kindly help on this issue.
$xml =
'<?xml version="1.0" encoding="UTF-8"?>
<Lead>
<row no="1">
<FL val="Layout">2907483000001189001</FL>
<FL val="First Name">'.$fornavn.'</FL>
<FL val="Last Name">'.$efternavn.'</FL>
<FL val="Email">'.$email.'</FL>
<FL val="phone">'.$phone.'</FL>
<FL val="Lead Source">'.$leadsource.'</FL>
<FL val="Individual">'.$individual.'</FL>
<FL val="Signed Up">'.$signup.'</FL>
<FL val="Address 1">'.$address.'</FL>
<FL val="City">'.$city.'</FL>
<FL val="State">'.$state.'</FL>
<FL val="Zip Code">'.$zipcode.'</FL>
<FL val="Country">USA</FL>
<FL val="Description">'.$comment.'</FL>
</row>
</Lead>';
$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);
return $response;