我目前使用LightOpenID允許用戶登錄到我的網站,在那裏我可以自動提取他們的用戶名和電子郵件地址:使用LightOpenID獲取Google通訊錄?
$openid->required = array('namePerson/first', 'namePerson/last', 'contact/email');
$openid->identity = 'https://www.google.com/accounts/o8/id';
這裏我使用的參數namePerson/first
,namePerson/last
和contact/email
。
我明白序獲取用戶的聯繫人列表,我不得不使用飼料:
https://www.google.com/m8/feeds
不過,我似乎無法找出哪些參數,我需要使用此?
如果我完全去除放慢參數線,我只是得到一個空數組回來。
任何人都可以請幫我找出我需要哪些參數來獲取聯繫人?
下面是當前代碼我有:
<?php
require '/var/www/libraries/openid.php';
try {
$openid = new LightOpenID;
if(!$openid->mode) {
//$openid->required = array('gd/fullName');
$openid->identity = 'https://www.google.com/m8/feeds/contacts/oshirowanen.y%40gmail.com/full';
header('Location: ' . $openid->authUrl());
exit;
} elseif($openid->mode == 'cancel') {
echo "cancelled";
exit;
} else {
if ($openid->validate()) {
$returned = $openid->getAttributes();
print_r($returned);
exit;
} else {
echo "something is wrong";
exit;
}
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
?>
添加了我目前擁有的所有代碼。 – oshirowanen