PHP Fatal error: Uncaught CurlException: 28 and 35 on Facebook apps - php

I randomly get following error. It doesn't happen everytimes.
PHP Fatal error: Uncaught CurlException: 28: Operation timed out after 60 seconds with 47 out of 47 bytes received
PHP Fatal error: Uncaught CurlException: 28: connect() timed out!
PHP Fatal error: Uncaught CurlException: 35: Unknown SSL protocol error in connection to graph.facebook.com:443
What I did try are
1. adding CURLOPT_SSLVERSION => 3 (even try changing to 2)
2. changing 'https://api-read.facebook.com/' to 'api_read' => 'https://api.facebook.com/'
3. adding $opts[CURLOPT_SSLVERSION] = 3;
curl_setopt( $ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
4. Changing CURLOPT_CONNECTTIMEOUT => from 10 to 60
5. closing IPv6 and add 69.171.224.54 graph.facebook.com to /etc/hosts (several other IPs also added)
6. telnet graph.facebook.com 443 and nslookup graph.facebook.com
I don't know where to look further. Please help!
FYI: cURL support = enabled, cURL Information = 7.15.5, OpenSSL Version = 0.9.8e (latest i can update on Centos 5.7)

All of these errors relate to the connection timing out during various phases of the HTTP process:
in the first, the connection was established, but no (or very little) data was returned
in the second, the connection couldn't be established at all
in the third, the TCP connection was established, but was dropped somewhere in the negotiation of a secure channel
As Shawn E. Carter says above, this bug appears to be the same issue https://developers.facebook.com/bugs/328399317246454?browse=search_4ff4817e0c5ec9768956669 as is this question Can not connect to Facebook with a curl request
Ultimately, it just means that Facebook's API server was a little slower than expected. You could try using a longer timeout, or, since it's intermittent, catching the exception and trying again.

Related

Curl/Laravel fails when loading resource but not when loaded from browser

We have a route that pulls JSON data from same server that is hosting the front-end but on a different sub domain. The call always fails with a connection refused error. However, pulling the data by calling the resource route directly works without issue.
Here is the failing code.
$client = new Client();
$response = $client->get("http://api.xxxxx.xx./invoice/".$accountNumber."/".$invoiceNumber."/".$date);
$invoicecontent = json_decode($response->getBody()->getContents());
The above always fails with this error:
ConnectException in CurlFactory.php line 186:
cURL error 7: Failed to connect to api.xxx.xx port 80: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
However, opening the failing page in the browser works perfectly.
Server enviroment:
Windows 10
XAMPP
PHP 7
Any suggestions would be appreciated.

Laravel cURL error 28: SSL connection timeout

I have a form with google recaptcha (if it does anything to do with this error) in my website. I'm running this project locally and sometimes get this error:
ConnectException in CurlFactory.php line 186:
cURL error 28: SSL connection timeout (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
When I refresh the form this error disappears. I checked some solution on stackoverflow and added set_time_limit(0); in my form handling controller but it didn't work

Failed to connect to accounts.google.com port 443: Operation timed out

I am trying to use Google Analytics API. After I enabled Analytic API I received my client_secrets.p12 and downloaded the API client library. I then replaced the service_account_email and changed the key_file_location. How ever when I run my script 'HelloAnalytics.php', I get an error:
PHP Fatal error: Uncaught exception 'Google_IO_Exception' with
message 'Failed to connect to accounts.google.com port 443: Operation
timed out' in
/Users/weiqi.tan/Downloads/ga_api/google-api-php-client/src/Google/IO/Curl.php:115
Stack trace:
0
/Users/weiqi.tan/Downloads/ga_api/google-api-php-client/src/Google/IO/Abstract.php(136):
Google_IO_Curl->executeRequest(Object(Google_Http_Request)) 1
/Users/weiqi.tan/Downloads/ga_api/google-api-php-client/src/Google/Auth/OAuth2.php(342):
Google_IO_Abstract->makeRequest(Object(Google_Http_Request)) 2
/Users/weiqi.tan/Downloads/ga_api/google-api-php-client/src/Google/Auth/OAuth2.php(314):
Google_Auth_OAuth2->refreshTokenRequest(Array) 3
/Users/weiqi.tan/Downloads/ga_api/HelloAnalytics.php(30):
Google_Auth_OAuth2->refreshTokenWithAssertion(Object(Google_Auth_AssertionCredentials))
4 /Users/weiqi.tan/Downloads/ga_api/HelloAnalytics.php(105):
getService() 5 {main} thrown in
/Users/weiqi.tan/Downloads/ga_api/google-api-php-client/src/Google/IO/Curl.php
on line 115
I don't know if anyone else ever had the same problem. Please tell me why this happened and how to solve it.
I had same problem today so
I just disable the firewall and it worked for me
I am using avg internet security

Fatal Error: CurlException: couldn't connect to host (PHP)

I've been developing an automatic delivery system for my shopify website on my local machine (EasyPHP) and everything worked fine and I've done multiple tests.
I've now transferred and updated everything for my online host (hostgator) and now I'm getting this error.
Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 7: couldn't connect to host [url] https://pas.mob.v7.easfc.ea.com:8095/pow/auth?timestamp=' in
And I have no idea why.
I think the problem is that you have to enable your openssl module. Otherwise you can't make a SSL connection.
You can enable the openssl module in your php.ini.

Facebook SDK error: uncaught curlexception: 28: connect() timed out! thrown in php

I just follow same code from Facebook SDK example.
If FB App point to my local desktop, it will get Facebook uid and user basic information (ex email) if APP get permission from OAUTH request.
But when I upload files to server, executing $facebook->api('/me');
Fatal error: Uncaught CurlException: 28: connect() timed out! thrown in
/xxx/src/facebook.php on line 622
I still can't figure out why. It comes from CURL or SSL setting?
My remote server support SSL and CURL is enabled. My local is only CURL but no SSL support.
I think my Facebook SDK is old version, only facebook.php without base_facebook.php.
I try to use new version but can't run any program because crt error.
You get this error because your host cannot access the Facebook API. It might have an old version of Open SSL, can you check the current version on the server?
Try to connect using SSL from your local setup as well as it might be easier to debug on your local machine.
Also, see about that crt (CRC?) error and try to fix that first (don't shave too many Yak's though).

Categories