首先对于这个noobish问题抱歉,我想从Facebook获取数据。我为我的网站设置了facebook应用程序,获取数据正在工作,但是当我将位置(Facebook信息)设置为私人时,返回的数据不包含位置数据。为什么我不能获取数据时,用户设置是私人的位置等(Facebook的PHP SDK)
这里是模型
class Facebook_model extends CI_Model {
public function __construct()
{
parent::__construct();
$config = array(
'appId' => 'APP_ID',
'secret' => 'SECRET',
'fileUpload' => true,
);
$this->load->library('Facebook', $config);
$user = $this->facebook->getUser();
$profile = null;
if($user)
{
try
{
$profile = $this->facebook->api("/me", 'get');
}catch(FacebookApiException $e)
{
error_log($e);
$user = null;
}
}
$fb_data = array(
'me' => $profile,
'uid' => $user,
'loginUrl' => $this->facebook->getLoginUrl(
array(
'scope' => 'email,publish_stream,user_about_me,user_checkins,publish_stream,friends_about_me',
'redirect_uri' => base_url() . 'index.php/welcome/topsecret/'
)
),
'logoutUrl' => $this->facebook->getLogoutUrl()
);
$this->session->set_userdata('fb_data', $fb_data);
}
这里是我的虚拟帐户的输出,隐私设置为公开,
Array
(
[me] => Array
(
[id] => 100004160084328
[name] => Dave Batista
[first_name] => Dave
[last_name] => Batista
[link] => http://www.facebook.com/dave.batista.355
[username] => dave.batista.355
[birthday] => 08/03/1991
[hometown] => Array
(
[id] => 106050279435951
[name] => Quezon City, Philippines
)
[location] => Array
(
[id] => 106050279435951
[name] => Quezon City, Philippines
)
[gender] => male
[email] => [email protected]
[timezone] => 8
[locale] => en_GB
[updated_time] => 2012-08-12T23:38:18+0000
)
[uid] => 100004160084328
[loginUrl] => https://www.facebook.com/dialog/oauth? client_id=266349843476112&redirect_uri=http%3A%2F%2Fpractice.com%2Findex.php%2Fwelcome%2Ftopsecret%2F&state=5d41b131b2d1e631e721cd0f6a1056aa&scope=email%2Cpublish_stream%2Cuser_about_me%2Cuser_checkins%2Cpublish_stream%2Cfriends_about_me
[logoutUrl] => https://www.facebook.com/logout.php?next=http%3A%2F%2Fpractice.com%2Findex.php%2Fwelcome%2Ftopsecret%2F&access_token=AAADyPmfObpABABJKZCZBdAXy3iPJyu4qRFEAPI8XpWS94iFZAtvnnMDkzb8yBjgQQQ8oe2O38g9QzqN834jA9axvTT0RkulRBtNItTOIAZDZD
)
您将位置设置为私密。这不是你问题的答案吗? – Tim 2012-08-13 05:19:46
好耶,但万一?当用户将其设置为私人时,是否无法获取数据?顺便说一句,谢谢你的回复。 – tastebuds 2012-08-14 11:38:41