2012-12-21 103 views
1

經過網絡衝浪後,我真的在智慧結束。我知道這個問題已被多次提出,但沒有任何解決方案能解決我的問題。我想知道是否有任何其他已知的捲曲錯誤60的原因:「SSL證書問題,請驗證CA證書是否正常」。HTTPS站點上cURL錯誤60的可能原因是什麼?

我已經將CURLOPT_CAINFO設置爲pem文件(也嘗試過crt),並且在嘗試訪問pem文件時檢查權限不足。

下面的代碼的方式:

$url = 'https://example.com/'; 

$ch = curl_init(); 

curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 
curl_setopt($ch, CURLOPT_CAINFO, "/usr/local/apache2/htdocs/server/html/cacert.pem"); 

$response = curl_exec($ch); 

...do something 

curl_close($ch); 
+1

http://flwebsites.biz/posts/how-fix-curl-error-60- ssl問題 – SpYk3HH

回答

-1

你可以試試這個: -

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, **'https://example.com/'**); 
// Set so curl_exec returns the result instead of outputting it. 
curl_setopt($ch, CURLOPT_VERBOSE, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
// Get the response and close the channel. 
$response = curl_exec($ch); 
+0

謝謝,但我真的需要CURLOPT_SSL_VERIFYPEER設置爲true – greysaff

相關問題