问题
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email','manage_pages','pages_manage_cta','publish_pages','publish_actions'];
giving permissions.
$loginUrl = $helper->getLoginUrl('http://localhost/Facebook/insight.php', $permissions);
echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';
facebook Insight code.
$fb->setDefaultAccessToken($accessToken);
Get user groups detail
$requestPageInsights = $fb->request('GET', '/1364467436924381/insights/, $accessToken');
//Make a batch request
$batch = ['page-insights' => $requestPageInsights];
try {
$responses = $fb->sendBatchRequest($batch);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
Graph returned an error: An unknown error has occurred.
回答1:
Just experienced the same issue. The error seems to be with batched requests - The solution for us was to change the code to do the requests individually.
来源:https://stackoverflow.com/questions/44716169/requesting-page-insight-for-facebook-getting-error-graph-returned-an-error-an