0
我捲曲類:捲曲後數據,但不能從活的服務器
class curlpost{
function setoptions($option=array()){
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $option['url']);
curl_setopt($ch, CURLOPT_HEADER, $option['header']);
curl_setopt($ch, CURLOPT_POSTFIELDS, $option['postfields']);
curl_setopt($ch, CURLOPT_INFILESIZE, $option['filesize']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return curl_exec($ch) ;
}
}
我正在使用笨框架項目。當我在localhost環境中的代碼中調用此類中的方法時,它工作正常,但在活動服務器中,我得到500 internal server error
。在直播服務器curl_getinfo($ch)
結果:在本地服務器curl_getinfo($ch)
Array ([url] => http://liveserver/uploader/do_upload [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 0.021748 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [certinfo] => Array () [redirect_url] =>)
結果:
Array ([url] => http://localserver/uploader/do_upload [content_type] => text/html; charset=UTF-8 [http_code] => 200 [header_size] => 611 [request_size] => 210 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.20281 [namelookup_time] => 0.000321 [connect_time] => 0.000428 [pretransfer_time] => 0.000429 [size_upload] => 79372 [size_download] => 476 [speed_download] => 2347 [speed_upload] => 391361 [download_content_length] => 476 [upload_content_length] => 79372 [starttransfer_time] => 0.001535 [redirect_time] => 0 [certinfo] => Array () [redirect_url] =>)
查看錯誤日誌以獲取更多詳細信息。 – Shan
什麼是服務器配置?哪些版本和您的服務器啓用了curl?您是否嘗試通過打印一些測試數據來逐步調試? – webDev
@SSingh sorry.added調試結果。 – user2254798