I have been working on a facebook application which will be using Graph API for authentication, The code was working just fine tomorrow but now all of a sudden I have started receving Host is unreachable errors. The code I am using is:
$token_url = "https://graph.facebook.com/oauth/access_token?".
"client_id=[client_id]".
"&redirect_uri=http://www.next_big_website.com".
"&client_secret=[client_secret]".
"&code=" . $_GET['code'].
"&scope=manage_pages,publish_stream,publish_actions,read_mailbox,email".
"&response_type=token";
$response = file_get_contents($token_url);
And the error I receive is:
Warning (2): file_get_contents(https://graph.facebook.com/oauth/access_token?client_id=[client_id]&redirect_uri=http://www.next_big_website.com&client_secret=[client_secret]&code=somelong_and_ugly_code&scope=manage_pages,publish_stream,publish_actions,read_mailbox,email&response_type=token): failed to open stream: Network is unreachable [temp.php, line 112]
Please help me with this as I have no idea what might have caused this.
Ok, I digged a bit further and found the solution, this happens because facebook is trying to force IPv6, because whenever my server tries to connect using IPv4 Facebook rejects my request, tracert traces a path to facebook API servers and then request gets dropped.
Thanks