You have to specify the POSTFIELDS names. And following the documentation you sent (https://www.zoho.com/recruit/add-records.html) you should remove the xmlData
and duplicateCheck
parameters from the URL, it's a POST only API.
I think you also should add the xml declaration (<?xml version='1.0' standalone='yes'?>
)
So the code for the CURLOPT_POSTFIELDS definition would be the following:
$xml_builder = array(
'duplicateCheck' => 1 ,
'xmlData' => "
<?xml version='1.0' standalone='yes'?>
<Candidates>
<row no=\"1\">
<FL val=\"First name\">{$firstname}</FL>
<FL val=\"Last name\">{$lastname}</FL>
<FL val=\"Contact address\">{$lastname}</FL>
<FL val=\"Email ID\">{$email}</FL>
<FL val=\"Current job title\">{$headline}</FL>
</row>
</Candidates>"
);
And the $opts array should be like this:
$opts = array(
CURLOPT_URL =>'https://recruit.zoho.com/ats/private/xml/Candidates/addRecords?authtoken=#secrettoken&scope=recruitapi',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => $xml_builder
);