我正在尝试获得一个随机的朋友。我在 SO 上找到了这个线程,它看起来应该可以工作。这是我的代码:
$config = array(
'appId' => APP_ID,
'secret' => SECRET,
'cookie' => true,
);
$facebook = new Facebook($config);
$params = array(
'method' => 'fql.query',
'query' => "SELECT uid, name, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) order by rand() limit 1",
);
$result = $facebook->api($params);
echo print_r($result);
但我收到错误:
Fatal error: Uncaught Exception: 102: Requires user session thrown in /home/path/to/base_facebook.php on line 1050
问题出在哪里?我试图搜索可能的问题,但我没有成功......