您好,我正在使用 php curl 在http://www.alliedtravelcareers.com/feed/jobs.php添加作业,我正在使用 curl 方法传递所有参数,但出现错误,因为“未找到 POST 数据!请发送使用 POST 方法的数据。”。我正在使用 curl 发送数据
$data = '<?xml version="1.0" encoding="utf-8"?>
<source>
<apiKey>apikey</apiKey>
<method>add</method>
<jobs>
<job>
<jobId><![CDATA['.rand(1,9999).']]></jobId>
<title><![CDATA['.$job_desc->return->dto->title.']]></title>
<city><![CDATA['.$job_desc->return->dto->address->city.']]></city>
<state><![CDATA['.$job_desc->return->dto->address->state.']]></state>
<license><![CDATA['.$job_desc->return->dto->title.']]></license>
</job>
</jobs>
</source>';
$url = "http://www.alliedtravelcareers.com/feed/jobs.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,40000000000000000);
$output = curl_exec($ch);
curl_close($ch);
我在 curl 中正确发送数据,但仍然显示 No post data found 错误。
请帮助我,我尝试了许多 curl 更改,但没有成功。