0
我正在使用curl請求獲取短信的報告,但面臨一些問題。我也通過編碼url,但仍然相同的問題ckecked。 正在顯示400個錯誤的請求。HTTP錯誤400.請求形成嚴重。在捲曲請求
$url="http://api.smscountry.com/smscwebservices_bulk_reports.aspx?user=&passwd=&fromdate=19/04/2017 00:00:00&todate=19/04/2017 23:59:59&jobno=60210892"; //callbackURL=http://www.jouple.com/marketing/public/save/sms
$ch = curl_init();
if (!$ch){
die("Couldn't initialize a cURL handle");
}
$ret = curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// curl_setopt ($ch, CURLOPT_POSTFIELDS,
// "User=$user&passwd=$password&sid=$senderid");
// $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//If you are behind proxy then please uncomment below line and provide your proxy ip with port.
// $ret = curl_setopt($ch, CURLOPT_PROXY, "PROXY IP ADDRESS:PORT");
$curlresponse = curl_exec($ch); // execute
// print_r($ch);die;
if(curl_errno($ch))
echo 'curl error : '. curl_error($ch);
if (empty($ret)) {
// some kind of an error happened
die(curl_error($ch));
curl_close($ch); // close cURL handler
} else {
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
}
感謝Devinder Kumar,我改變了我的代碼,正如你所說的,但現在它給了這個錯誤。 「'/'應用程序中的服務器錯誤。」 –
請參閱此。 http://stackoverflow.com/questions/28888267/server-error-in-application-when-attempting-to-curl#answer-28907180 –