Does the API need any kind of key which would have been regenerated ?
Http::get cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0
I am fetching all countries from this API: $response = Http::get('https:// restcountries.com/v3.1/all'); (and it worked fine several days ago). I did not update Laravel or any other package, and it stopped working with error: "cURL error 56: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0".
Using postman, curl via terminal or even browser - API works.
I tried searching this forum - no working solutions, I tried google - same, I tried chat gpt - anything suggested throws same error. Same error in local env and on real server in production env.
When I try other API like "/v3.1/capital/tallinn" it works. I guess the content size from API increased in past several days and the problem is with the content length, which guzzle inside Http wrapper can't handle. But can't find the fix.
I tried using stream, custom headers, sink (it breaks at Sri Lanka), increase timeout, connection timeout, any possible solution or workaround I found - same error.
This is debug output:
* Host restcountries.com:443 was resolved. * IPv6: (none) * IPv4: 146.190.198.121 * Trying 146.190.198.121:443... * ALPN: curl offers http/1.1 * CAfile: /Users/kikky/Library/Application Support/Herd/config/php/cacert.pem * CApath: none * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / id-ecPublicKey * ALPN: server accepted http/1.1 * Server certificate: * subject: CN=restcountries.com * start date: Oct 25 14:44:04 2024 GMT * expire date: Jan 23 14:44:03 2025 GMT * subjectAltName: host "restcountries.com" matched cert's "restcountries.com" * issuer: C=US; O=Let's Encrypt; CN=E6 * SSL certificate verify ok. * Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384 * Certificate level 1: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using sha256WithRSAEncryption * Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha256WithRSAEncryption * Connected to restcountries.com (146.190.198.121) port 443 * using HTTP/1.x > GET /v3.1/all HTTP/1.1 Host: restcountries.com User-Agent: GuzzleHttp/7 * Request completely sent off < HTTP/1.1 200 OK < Server: nginx/1.22.1 < Date: Sun, 08 Dec 2024 19:50:22 GMT < Content-Type: application/json < Content-Length: 833487 < Connection: keep-alive < Cache-Control: public, immutable, max-age=31556926 < * OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0 * closing connection #0
Anyone has working solution?
Fixed it with custom header. Using php curl it also didn't pass, so I tried with postman and took this header from postman. Content length for this route is over 800 kb and such content size just fails using php curl. Of course, any AI was useless in resolving the issue.
$response = Http::withHeaders([ 'Accept-Encoding' => 'gzip, deflate, br', ])->get('https://restcountries.com/v3.1/all');
Please or to participate in this conversation.