我正在尝试实现 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
根据 Failed to connect to graph.facebook.com port 443: Network unreachable 的建议我试过了
$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);
这导致我的页面加载了 google。
不幸的是没有给出解决方案,所以希望其他人可以帮助我。
//我在共享主机上,我无法更改 php.ini 文件
最佳答案
file_get_contents 已被阻止,正如 Sojan V Jose 评论的那样,您必须启用它才能使其正常工作!据我所知,没有办法绕过它。
关于php - Facebook 登录无法连接到 graph.facebook.com :443; Operation now in progress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27647042/