Php 将with modifier与facebook API一起用于用户位置
我正在尝试从Php 将with modifier与facebook API一起用于用户位置,php,facebook,facebook-graph-api,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 (FacebookApiExc
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;
}
}
当我打印这篇文章时,它会给我整个提要,而不仅仅是API所说的带有位置的文章。。。
这是我的全部代码
<?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')
);
}
?>
您是否将打印$feed
或$facebook->api('/me/feed')
作为打印($facebook->api('/me/feed'))代码>;)?我像这样打印($facebook->api('/me/feed');在这种情况下,您没有发送参数?with=location
,或者在您的情况下发送数组$p=array('with'=>'location')
,那么我该如何打印它呢?打印($facebook->api('/me/feed',GET,array('with'=>'location',);是的,尝试一下,并引用GET-like'GET'
<?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')
);
}
?>