Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:48:12+00:00 2026-06-06T13:48:12+00:00

I have been working on a facebook application which will be using Graph API

  • 0

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=%5Bclient_id%5D&redirect_uri=http://www.next_big_website.com&client_secret=%5Bclient_secret%5D&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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:48:14+00:00Added an answer on June 6, 2026 at 1:48 pm

    Fixed it by using

     $url = ("https://graph.facebook.com/me/access_token?token");
        $c = curl_init();
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($c, CURLOPT_URL, $url);
        curl_setopt($c, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); 
        $contents = curl_exec($c);
        $err  = curl_getinfo($c,CURLINFO_HTTP_CODE);
        curl_close($c);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on facebook application and you know on facebook native javascript
I have been working on trying to pull friends birthdays from the facebook API
I have been using facebook api for a time, but recently there is a
Possible Duplicate: Add picture at facebook event with Graph API I have been trying
I'm using omniauth to implement twitter authentication in my application. I have facebook authentication
I've been recently working with facebook graph api , when I'm pulling user's recents
I have been working on this app for at least 3-4 months and just
I've been playing around the Facebook Graph API for a while now. I'm trying
I am working on an app which will upload videos to a Facebook users
Users have been able to log into my website using their Facebook account, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.