![](/img/trans.png)
[英]GuzzleHttp\Exception\RequestException cURL error 3: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) when installing laravel 6
[英]Laravel Guzzlehttp cURL error 56: SSLRead() return error -9806 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
我們有使用Oauth 1.0
使用 API 的網站。 直到幾天前,該網站一直運行良好。 我們使用 API 的服務器移至新的托管服務提供商。 從那時起,我們收到了錯誤消息
cURL 錯誤 56:SSLRead() 返回錯誤 -9806(參見http://curl.haxx.se/libcurl/c/libcurl-errors.html )
我們嘗試禁用 ssl 驗證,但這似乎也不起作用。 似乎我們根本無法訪問服務器。 服務提供商告訴我們,我們的程序根本沒有到達他們服務器的記錄。
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
.....
$headers = [
'Content-Type' => 'application/json',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: en-US,en;q=0.5',
'Accept-Encoding: gzip, deflate',
'Connection: keep-alive',
];
$client = new Client(['base_uri' => self::getBaseUrl().'/ETCAPICP/api/', 'headers' => $headers]);
實際結果:
消息:“cURL 錯誤 56:SSLRead() 返回錯誤 -9806(參見http://curl.haxx.se/libcurl/c/libcurl-errors.html )”
期望的是,程序應該能夠成功完成握手並能夠使用API
任何幫助表示贊賞。 謝謝
每當 Guzzle 嘗試建立 curl 連接時,它都會准備並提交具有可用信息的請求。 如果它沒有任何信息,它只是將該參數設置為 null。
請求中“User-Agent”的標頭值為空,這似乎是罪魁禍首。 我必須在標頭請求中添加“User-Agent”,現在一切正常。
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
.....
$headers = [
'User-Agent' => 'Testing 1.0'
];
$client = new Client(['base_uri' => self::getBaseUrl().'/ETCAPICP/api/', 'headers' => $headers]);
希望這對其他有類似問題的人有所幫助。
通常它可能意味着某些參數值為空或 null。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.