Reputation: 73
Any one knows about this message ("CurlException: 6: Couldn't resolve host 'graph.facebook.com'") when you are trying to get "$facebook->getUser()" or $facebook->api('/me'); I really appreciated your help
Upvotes: 3
Views: 10688
Reputation: 8809
I fixed this problem by setting FacebookCurlHttpClient.php line 104:
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V6
You should not have to edit the PHP-SDK code and just do this in your code:
$fb = new Facebook\Facebook([...]);
$fb->getClient()->getHttpClientHandler()->facebookCurl->setopt(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
But the FacebookHttpClientInterface
only exposes the send
method (and the facebookCurl
member variable is protected), so that's not possible.
Upvotes: 0
Reputation: 111
Had the same case in my environment - restarting the virtual server / the ntpd service did not solve the issue
Only when I restarted the host machine did this error go away
Upvotes: 5
Reputation: 3867
I was receiving this error on my local dev server, and turns out that I needed to just reboot the operating system.
In my case, I'm using a bridged network connection. If the internet connection is changed or disabled at all on the host operating system while using the dev server, something gets altered with the DNS.
Upvotes: 2
Reputation: 134
Your host is most likely blocking outgoing connections. If you can ssh to the server try pinging graph.facebook.com and see if you can reach that server from your server. If you don't have ssh access to the server you could try using php exec or system to run the ping command.
It also may be due to your host not allowing urls to be opened within php or not allowing SSL.
Check this search for more ideas from the facebook dev forums: Google
Upvotes: 0
Reputation: 43816
Your server must not be able to resolve graph.facebook.com - is your production environment behind a Firewall or does it have misconfigured DNS?
Upvotes: 2