Php 无法访问Facebook图形API

Php 无法访问Facebook图形API,php,facebook,facebook-graph-api,file-get-contents,Php,Facebook,Facebook Graph Api,File Get Contents,我一直在开发一个facebook应用程序,该应用程序将使用Graph API进行身份验证,明天代码运行良好,但现在突然我开始接收主机无法访问的错误。我使用的代码是: $token_url = "https://graph.facebook.com/oauth/access_token?". "client_id=[client_id]". "&redirect_uri=http://www.next_big_website.

我一直在开发一个facebook应用程序,该应用程序将使用Graph API进行身份验证,明天代码运行良好,但现在突然我开始接收主机无法访问的错误。我使用的代码是:

$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);
我收到的错误是:

警告(2):文件获取内容(https://graph.facebook.com/oauth/access_token?client_id=[客户端\u id]&重定向\u uri=http://www.next_big_website.com&client_secret=[client\u secret]&code=somelong\u和\u sugger\u code&scope=manage\u页面、发布\u流、发布\u操作、读取\u邮箱、电子邮件和响应\u type=token):无法打开流:无法访问网络[temp.php,第112行]

请帮我解决这个问题,因为我不知道是什么原因造成的

好的,我进一步挖掘并找到了解决方案,这是因为facebook试图强制IPv6,因为每当我的服务器尝试使用IPv4连接时,facebook拒绝我的请求,tracert跟踪到facebook API服务器的路径,然后请求被丢弃

谢谢

 $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);

您的php.ini中是否打开了文件\u get\u内容的https流?此外,您试图对此调用执行什么操作?我如何打开这些操作?我正在尝试为用户获取访问令牌。感谢用户验证了您的应用程序?这是您的网络问题,请检查您的网络设置,特别是检查您的IPV4和IPV6是否都处于正常状态接口都是配置的这几乎肯定不是代码问题,是您的代码无法访问facebook的服务器,是您的服务器配置、防火墙、主机、ISP或其他网络存在问题