0

I want to integrate fb into my website and pull work_history. I've literally gone through every forum question and read the fb pages. From what I've read you need a token to access the info. Do you also need to run a fql query? How can I get the token to get friends work_history? Below is what I tried.

$user = $facebook->getUser();
$token  = array($facebook->getAccessToken());

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');

    $fql = "SELECT uid, name, work_history, FROM user WHERE 
    uid = ' . $user.'";
        $ret_obj = $facebook->api(array(
                                   'method' => 'fql.query',
                                   'query' => $fql,
                                 ));


    echo '<pre>Pic: ' . $ret_obj[3]['work_history'] .'</pre>';                           


 } catch (FacebookApiException $e) {
    error_log($e);
    $user_profile = null;
  }
}

if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl(array(
  'scope' => 'user_work_history',
  'redirect_uri' => 'http://www.myweb.com')

  );
}
4

1 回答 1

1


“用户”表文档https://developers.facebook.com/docs/reference/fql/user/说 work_history 已被弃用,您应该使用列 work 代替。此外,您需要 user_work_history 权限才能访问数据。
FWIW,我运行了这个查询 - SELECT uid, name, work FROM user where uid = me() 它对我有用。

于 2012-08-29T00:50:48.623 回答