我試圖使用HTTPS鏈接發出soap請求。 我得到捲曲失敗:0(這意味着沒有錯誤)但是,我收到一個空字符串。使用Curl的HTTPS請求失敗:0但Curl中沒有響應PHP
$url = $soapUrl;
$soap_do = curl_init();
set_time_limit(0);
curl_setopt($soap_do, CURLOPT_URL, $url);
curl_setopt($soap_do, CURLOPT_AUTOREFERER, true);
curl_setopt($soap_do, CURLOPT_MAXREDIRS, 10);
curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($soap_do, CURLOPT_POST, true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml_post_string);
curl_setopt($soap_do, CURLOPT_VERBOSE, TRUE);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($soap_do);
$error = curl_error($soap_do);
var_dump($response);
echo "Curl Failed: " . curl_errno($soap_do), "<br/>";
echo curl_error($soap_do);
我的代碼有問題嗎?
使用'curl_getinfo()'查看關於請求結果的更多細節。 –
您缺少''output = curl_exec($ soap_do);' – Hackerman
我更新了我的代碼請chewck – phpmeter