0
我使用FB一批API用戶登錄,這也是API調用Facebook的一批API不返回用戶的電子郵件ID
$queries = array(
array('method' => 'GET', 'relative_url' => '/'.$user),
array('method' => 'GET', 'relative_url' => '/'.$user.'/home?limit=50'),
array('method' => 'GET', 'relative_url' => '/'.$user.'/friends'),
array('method' => 'GET', 'relative_url' => '/'.$user.'/photos?limit=6'),
);
// POST your queries to the batch endpoint on the graph.
try{
$batchResponse = $facebook->api('?batch='.json_encode($queries), 'POST');
}catch(Exception $o){
error_log($o);
}
//Return values are indexed in order of the original array, content is in ['body'] as a JSON
//string. Decode for use as a PHP array.
$user_info = json_decode($batchResponse[0]['body'], TRUE);
$feed = json_decode($batchResponse[1]['body'], TRUE);
$friends_list = json_decode($batchResponse[2]['body'], TRUE);
$photos = json_decode($batchResponse[3]['body'], TRUE);
當我打印USER_INFO變量print_r($user_info)
我得到這個數組,但它不給我的用戶電子郵件ID。我不知道爲什麼?我通過文檔,但沒有找到解決方案。如何實現這一目標?
如果由於身份驗證,我如何向API發送可信參數,並且身份驗證是否僅適用於電子郵件地址而不適用於其他字段?
Array
(
[id] => 1000015567757
[name] =>Name
[first_name] => First name
[last_name] => Last name
[link] => http://www.facebook.com/sach.ch
[username] => sachtawa
[birthday] => 12/13/1987
[hometown] => Array
(
[id] => 1000015534545
[name] => Patna, India
)
[location] => Array
(
[id] => 106442706060302
[name] => Pune, Maharashtra
)
[gender] => male
[timezone] => 6
[locale] => en_US
[verified] => 1
[updated_time] => 2012-12-13T04:11:12+0000
)
感謝您的關注
感謝您的輸入,但我仍然努力實現這一目標。我使用了'parse_signed_request'函數,但是我得到了函數聲明的錯誤,如果我打印請求數組,我得到數組中的多個字段,接着是上面的錯誤。如果你告訴我wh很有幫助在我需要使用的功能來實現它。事實上,我對它很陌生,並試圖瞭解這個功能是如何工作的。 – KillABug
當你讓用戶授權你的應用時,你向用戶請求什麼用戶權限? – TommyBs
感謝您的輸入,我能夠實現使用由FB提供的不同API來獲取更新的安全補丁。 – KillABug