Fatal error: "Could not connect to host"! (Facebook API)

I am trying to add the Facebook API to my web application.

But when I tried to publish links using the Graph API, I got this error:

Fatal error: throw exception "Facebook \ FacebookSDKException" with the message "failed to connect to the host" in / home / u 614270703 / public_html / test / vendor / facebook / php-sdk-v4 / src / Facebook / HttpClients / FacebookCurlHttpClient.php: 156 Stack Trace: # 0 / home / u 614270703 / public_html / test / vendor / facebook / php-sdk-v4 / src / Facebook / FacebookRequest.php (248): Facebook \ HttpClients \ FacebookCurlHttpClient-> send (' https: / /graph.f ... ',' POST ', Array) # 1 / home / u614270703 / public_html / test / session2.php (32): Facebook \ FacebookRequest-> execute () # 2 {main} thrown in / home / u 614270703 / public_html / test / vendor / facebook / php-sdk-v4 / src / Facebook / HttpClients / FacebookCurlHttpClient.php on line 156

I do not know what's going on. What does this error mean? I do not know why I cannot connect to the host.

-2
source share
1 answer

Your server will probably block outgoing CURL requests, will contact your provider and ask him if he can open access to the Facebook API server (graph.facebook.com).

There are other topics in this:

+1
source

Source: https://habr.com/ru/post/1216381/


All Articles