簡體   English   中英

PHP curl返回(35):SSL連接錯誤

[英]PHP curl returns (35): SSL connect error

我試圖使用以下代碼使用php curl 7.35.0訪問以下頁面:

    $this->ch = curl_init();
    curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 3000);
    curl_setopt($this->ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36");
    curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($this->ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
    curl_setopt($this->ch, CURLOPT_TIMEOUT, 3600);
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($this->ch, CURLOPT_URL, 'https://asp.reflexion.net/login');
    curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
    $content  = curl_exec($this->ch);
    $httpCode = curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
    if ($errno    = curl_errno($this->ch))
    {
        $error_message = curl_strerror($errno);
        echo "cURL error ({$errno}):\n {$error_message}";
    }
    echo "<br>";
    echo "http code: " . $httpCode . "<br>";
    echo "content: " . $content;

返回以下內容:

cURL錯誤(35):SSL連接錯誤

http代碼:0內容:

有人遇到過這個問題嗎?

添加

curl_setopt($this->ch, CURLOPT_SSLVERSION , 3);

解決我的問題。

通常,這是防火牆問題。 網絡管理員禁止SSL連接。

這對我yum update nssyum update nss

資料來源: https : //serverfault.com/a/642203

這也解決了我的問題。

我們的環境

PHP 5.3.3 libcurl 7.19.7-46 google-api-php-client 1.1.5

在Google API客戶端Curl代碼的深處,httpd會在curl_exec()內部死亡。 將CURLOPT_SSLVERSION從1更改為3后,一切都很好:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM