Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FacebookPHP SDK提供了很多异常_Php_Facebook_Facebook Graph Api_Facebook Php Sdk - Fatal编程技术网

FacebookPHP SDK提供了很多异常

FacebookPHP SDK提供了很多异常,php,facebook,facebook-graph-api,facebook-php-sdk,Php,Facebook,Facebook Graph Api,Facebook Php Sdk,这些是例外情况 异常“Facebook\FacebookSDKException”,消息为“无法连接到2a03:2880:20:4f06:face:b00c:0:1:网络无法访问”,位于/home/handrhf/public_html/www.bhartibattery.com/inc/Facebook/HttpClients/FacebookCurlHttpClient.php:150堆栈跟踪:#0/home/handrhf/public_html/www.bhartibattery.com

这些是例外情况


异常“Facebook\FacebookSDKException”,消息为“无法连接到2a03:2880:20:4f06:face:b00c:0:1:网络无法访问”,位于/home/handrhf/public_html/www.bhartibattery.com/inc/Facebook/HttpClients/FacebookCurlHttpClient.php:150堆栈跟踪:#0/home/handrhf/public_html/www.bhartibattery.com/inc/Facebook/FacebookRequest.php(248):Facebook\HttpClients\FacebookCurlHttpClient->send(‘…’,‘GET',Array)#1/home/handrhf/public_html/www.bhartibattery.com/inc/Facebook/FacebookRedirectLoginHelper.php(185):Facebook\FacebookRequest->execute()#2/home/handrhf/public#html/www.bhartibattery.com/index.php(45):Facebook\Facebook-redirectloginhelper->-getsessionfromfirect()#{main}

这是代码

$appId = '541501275992239';
$appSecret = 'a6b15bbdd2f6b3a7a5a8893d7aca3f06';
$redirectUrl = 'http://www.bhartibattery.com';

FacebookSession::setDefaultApplication($appId, $appSecret);

$helper = new FacebookRedirectLoginHelper($redirectUrl);

try{
    $session = $helper->getSessionFromRedirect();
}
catch(FacebookRequestException $ex) {
    echo 'Facebook error';
}
catch(Exception $e) {
    echo 'Something went wrong:' . $e ;
}

$loginUrl = $helper->getLoginUrl();

if(isset($session)) {
    $request = new FacebookRequest($session, 'GET', '/me');
    $response = $request->execute();
    $graphObject = $response->getGraphObject(GraphUser::classname());

    $name = $graphObject->getName();
    $id = $graphObject->getId();
    $img = 'https://graph.facebook.com/' . $id . '/picture?width=500';

    echo 'Hi' . $name . '<br>';
    echo 'Photo: <img src=' .$img . '><br>';
}
else{
    echo '<a href="' . $loginUrl . '">Login with Facebook</a>';
}
$appId='541501275992239';
$appSecret='A6B15BDD2F6B3A7A5A8893D7ACA3F06';
$URL=http://www.bhartibattery.com';
FacebookSession::setDefaultApplication($appId,$appSecret);
$helper=newfacebookRedirectLoginHelper($redirectUrl);
试一试{
$session=$helper->getSessionFromRedirect();
}
捕获(FacebookRequestException$ex){
echo“Facebook错误”;
}
捕获(例外$e){
echo“出了问题:”。$e;
}
$loginUrl=$helper->getLoginUrl();
国际单项体育联合会(isset($届会)){
$request=newfacebookrequest($session,'GET','/me');
$response=$request->execute();
$graphObject=$response->getGraphObject(GraphUser::classname());
$name=$graphObject->getName();
$id=$graphObject->getId();
$img='1https://graph.facebook.com/“.$id.”/图片?宽度=500';
回显“嗨”。$name.“
”; 回声“照片:
”; } 否则{ 回声'; }
您的服务器在通过IPv6I连接到Facebooks服务器时出现问题我告诉了处理服务器的人员,他说有一些恶意文件,因此端口80/100被关闭。当我清理这些文件时,他重新打开了这些文件,但现在我从facebook收到异常这些是异常facebook错误:异常“facebook\Face”bookAuthorizationException“带有消息”验证验证代码时出错。请确保您的重定向uri与您在/home/handrhf/public_html/www.bhartibatty.com/inc/facebook/FacebookRequestException.php:104堆栈跟踪:#0/home/handrhf/public_html/www.bhartibatty.com/inc/facebook中的OAuth对话框请求中使用的uri相同/FacebookRequest.php(268):Facebook\FacebookRequestException::create(“{”error:“{”mess…”,Object(stdClass),400)#1/home/handrhf/public_html/www.bhartibattery.com/inc/Facebook/FacebookRedirectLoginHelper.php(185):Facebook\FacebookRequest->->execute()#2/home/handrhf/public_html/www.bhartibattery.com/index.php(44):Facebook\FacebookRedirectLoginHelper->getSessionFromRedirect()#3{main}