0
你好我正在使用php curl來添加作業http://www.alliedtravelcareers.com/feed/jobs.php,我使用curl方法傳遞了所有的參數,但是我得到的錯誤是「沒有發現POST數據!請使用POST方法發送數據。 。我使用curl發送數據使用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中正確發送數據,但仍顯示我找不到任何後期數據的錯誤。
請幫我我已經嘗試了許多捲曲變化,但沒有成功。
這只是您複製和粘貼代碼的格式錯誤? ''; \'' –
在附註上,零無限期等待超時:'curl_setopt($ curl,CURLOPT_TIMEOUT,0);' –