I am working on a facebook application that will use the Graph API for authentication. The code worked fine, but now I suddenly started getting a host, these are unattainable errors. The code I'm 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 received:
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): could not open the stream: network is unavailable [temp.php, line 112]
Please help me with this, as I have no idea what could cause this.
Ok, I stumbled a bit and found a solution. This is because facebook tries to force IPv6, because whenever my server tries to connect using IPv4, Facebook rejects my request, traces the trace of the path to the facebook API servers, and then requests to crash.
thanks
source share