8

I am using Facebook Current PHP SDK. My app was running ok. BUt from today any api call returning Failed to connect to 2a03:2880:10:1f03:face:b00c:0:26: Network is unreachable.

Here is my code

  try {
    $fbme = $facebook->api('/me');
  } catch (Exception $e) {        
  echo $e->getMessage();        
  }

Is any one having this problem? How can I fix this?

Zakir Hyder
  • 627
  • 1
  • 7
  • 17

2 Answers2

11

There is one more solution for this problem, found it on http://codecorner.galanter.net/2011/06/03/solution-for-wordpress-curl-ipv6-error-network-is-unreachable/

You can simply force IPV4 resolve by setting the following curl option :

curl_setopt( $handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
j0k
  • 22,600
  • 28
  • 79
  • 90
Le Gnav
  • 113
  • 1
  • 5
6

Your server's network or firewall is likely misconfigured; disable your IPV6 interface if you don't have IPV6 connectivity

Igy
  • 43,710
  • 8
  • 89
  • 115
  • Added IPV6 functionality to server and rebooted. This problem is gone. – Zakir Hyder Jun 27 '12 at 20:41
  • @igy Thanks for your answer. I've been using the Facebook API for months with no problem, and suddenly tonight I started getting "Network is unreachable" on every call. My server is on Cloudways shared hosting. None of my code has changed in recent days. Is your guess that something must have changed with Cloudways? What is in my control / would you recommend for me to change to get this working again? Thanks! – Ryan Apr 22 '17 at 02:07