使用 graph.facebook.com 获得的结果似乎与您从他们自己的搜索结果中获得的结果不匹配。
例如: https://graph.facebook.com/search?q=www.mightytrainer.com&type=post&limit=25
对比
乔·古德温 (Joe Goodwin) 或塔林·希根 (Taryn Higgan) 都与我没有共同的 friend 。它们显示在网络结果中,但不显示在图表中。
我是否遗漏了一些基本的东西?
最佳答案
尝试使用用户访问 token 进行相同的搜索,就用户隐私设置而言,结果应该相似。
https://graph.facebook.com/search?q=www.mightytrainer.com&type=post&limit=25&access_token=your_user_access_token
图形浏览器中的示例。
引用: https://developers.facebook.com/docs/concepts/login/access-tokens-and-types/
php 示例:假设 php sdk 3.1.1。已安装,并且应用程序已设置。
// init sdk, sample coming
require './src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'Your App Id Here',
'secret' => 'Your App Secret Here',
'cookie' => true, // enable optional cookie support
));
try { $user = $facebook->getUser(); } catch (FacebookApiException $e) { }
// Get the current access token if user.
if($user){
$access_token = $facebook->getAccessToken();
// in the case of ajax we need to set the access token or will get expired error.
// Comment out api get token, uncomment session.
// $access_token = $_SESSION['fb_YourAppIdHere_access_token'];
if($access_token){ $facebook->setAccessToken($access_token); }
};
// access token usage should be handled by api.
$api_search = $facebook->api('/search?q=www.mightytrainer.com&type=post');
// print results array
echo '<pre>';
print_r($api_search);
echo '</pre>';
JavaScript 示例:
// init sdk, sample coming
关于php - Facebook Graph 搜索结果与 "Public Posts"结果不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13939897/