我不知道如何配置facebook sdk。我只是用谷歌搜索指令。但是我总是在每个错误修复中得到这个错误。我从facebook官方页面使用最新的facebook php sdk ..我在谷歌上发现此错误.. 这是facebook链接帖子示例..我只是测试多种方式..或者你可以解释如何配置facebook php sdk..Thank
<?php
require_once __DIR__ . '/src/Facebook/autoload.php';
require_once __DIR__ . '/src/Facebook/Facebook.php';
use Facebook\Facebook;
use Facebook\autoload;
use Facebook\Exception;
$fb = new Facebook([
'app_id' => 'my-app-id',
'app_secret' => 'my-app-secret',
'default_graph_version' => 'v2.5'
]);
$linkData = [
'link' => 'http://www.example.com',
'message' => 'User provided message',
];
/* $helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
} catch(Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} */
//var_dump($fb);
// $fb->setExtendedAccessToken();
// Get access short live access token
$accessToken ='REMOVED';
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post('/me/feed', $linkData, $accessToken);
var_dump($response);die;
} catch(FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
echo 'Posted with id: ' . $graphNode['id'];
致命错误:未捕获的异常 带有消息的'Facebook \ Exceptions \ FacebookAuthenticationException' 'API参数中提供的appsecret_proof无效' C:\瓦帕\ WWW \ Facebook的PHP-SDK-v4-5.0.0 \ SRC \实\例外\ FacebookResponseException.php:100 堆栈跟踪:#0 C:\瓦帕\ WWW \ Facebook的PHP-SDK-v4-5.0.0 \ SRC \实\ FacebookResponse.php(210): Facebook的\例外\ FacebookResponseException ::创建(对象(实\ FacebookResponse))
1 C:\ wamp \ www \ facebook-php-sdk-v4-5.0.0 \ src \ Facebook \ FacebookResponse.php(255):
Facebook \ FacebookResponse-&gt; makeException()#2 C:\瓦帕\ WWW \ Facebook的PHP-SDK-v4-5.0.0 \ SRC \实\ FacebookResponse.php(82): Facebook \ FacebookResponse-&gt; decodeBody()#3 C:\瓦帕\ WWW \ Facebook的PHP-SDK-v4-5.0.0 \ SRC \实\ FacebookClient.php(225): Facebook的\ FacebookResponse-&GT; __构建体(对象(实\ FacebookRequest), '{“error”:{“mess ...',400,Array)#4 C:\瓦帕\ WWW \ Facebook的PHP-SDK-v4-5.0.0 \ SRC \实\ Facebook.php(504): Facebook的\ FacebookClient-&GT; sendRequest将(对象(实\ FacebookRequest))
5 C:\ wamp \ www \ facebook-php在C:\ wamp \ www \ facebook-php-sdk-v4-5.0.0 \ src \ Facebook \ Exceptions \ FacebookResponseException.php
第100行