我正在尝试实现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文件。