使用带有facebook API的修饰符为用户定位

时间:2014-05-29 16:12:24

标签: php facebook facebook-graph-api

我正在尝试从me/feed

获取用户位置

喜欢这个

if ($user) {
  try {
    $user_profile = $facebook->api('/me');
     $friends = $facebook->api('/me/friends');
    $feeds = $facebook->api('/me/feed', 
  array (
    'with' => 'location',
  )); 
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

当我打印它时,它给了我整个Feed,而不仅仅是像API这样的帖子说它会...... Docs Here

 print_r($facebook->api('/me/feed'));

这是我的代码。

<?php        
require 'facebookAPI/src/facebook.php';

$facebook = new Facebook(array(
  'appId'  => '0000000',
  'secret' => '000000000',
));

$user = $facebook->getUser();

if ($user) {
  try {
    $user_profile = $facebook->api('/me');
     $friends = $facebook->api('/me/friends');
    $feeds = $facebook->api('/me/feed', 
  array (
    'with' => 'location',
  )); 
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

if ($user) {
$params = array( 'next' => 'http://www.wuno.com/sandbox/actions/fbLogout.php' );
$logoutUrl = $facebook->getLogoutUrl($params);
} else {
  $loginUrl = $facebook->getLoginUrl(array(
    'scope' => 'user_about_me, user_checkins, friends_checkins, user_location, friends_location, read_stream')
  );
}
?>

0 个答案:

没有答案