Facebook登录失败 连接graph.facebook.com:443失败;操作正在进行中。

5

我正在尝试实现Facebook登录,以下是我的代码:

$helper = new Facebook\FacebookRedirectLoginHelper(URL('facebook/login'), $apiVersion = NULL);
try
{
    $session = $helper->getSessionFromRedirect();
} catch (Facebook\FacebookRequestException $ex)
{
    // When Facebook returns an error
    return Redirect::to('login')->with('error-message', 'Facebook could not validate your account.');
} catch (\Exception $ex)
{
    // When validation fails or other local issues
    // FAIL HAPPENS HERE 
    return $ex->getMessage();
}

但是我得到了
Facebook login Failed connect to graph.facebook.com:443; Operation now in progress

正如无法连接到graph.facebook.com端口443:网络不可达所建议的,我尝试了一下

  $data = file_get_contents('https://graph.facebook.com/4'); print_r( $data );

这导致页面加载失败,建议您尝试以下方法:

$ch = curl_init("https://google.com"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); print($data);

这导致谷歌被加载到我的页面。

不幸的是,没有提供解决方案,所以希望其他人能够帮我解决。

// 我使用共享主机,无法更改php.ini文件。


1
file_get_contents在许多共享托管服务器上被阻止。很可能这是您的托管提供商的问题。您是否尝试联系支持?为什么不尝试像Digital Ocean这样的东西呢? - Sojan Jose
1个回答

0

file_get_contents被阻止了,正如Sojan V Jose所评论的那样,你必须启用它才能使其工作!据我所知,没有绕过它的方法。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接