我正在尝试从Gravatar检索信息到我的Joomla。我成功地从头像中检索了我的图像,但我正在努力检索其他个人资料信息。
$str = file_get_contents('http://www.gravatar.com/205e460b479e2e5b48aec07710c08d50.php' );
$profile = unserialize( $str );
if ( is_array( $profile ) && isset( $profile['entry'] ) )
echo $profile['entry'][0]['displayName'];
?>
以下代码在 gravtar 文档中,它只输出我的 gravtar 名称。如何获取其他必要的个人资料信息?!我对PHP也有点陌生。
谢谢。
对不起,我完全误解了你的问题:-D
如果用户自己设置了即时消息、电子邮件和电话等值,则可用。请记住,$profile['entry'][0]['ims']
是一个数组,其键表示从零到数组长度减一。
echo $profile['entry'][0]['emails'][0]['value'];
echo $profile['entry'][0]['ims'][0]['value'] ;
echo $profile['entry'][0]['ims'][0]['type'] ;
ims
数组是这样的:
["ims"]=>
array(6) {
[0]=>
array(2) {
["type"]=>
string(3) "aim"
["value"]=>
string(10) "checkmeout"
}
[1]=>
array(2) {
["type"]=>
string(3) "msn"
["value"]=>
string(10) "checkmeout"
}
[2]=>
array(2) {
["type"]=>
string(5) "yahoo"
["value"]=>
string(10) "checkmeout"
}
[3]=>
array(2) {
["type"]=>
string(3) "icq"
["value"]=>
string(10) "checkmeout"
}
[4]=>
array(2) {
["type"]=>
string(5) "gtalk"
["value"]=>
string(10) "checkmeout"
}
[5]=>
array(2) {
["type"]=>
string(5) "skype"
["value"]=>
string(10) "checkmeout"
}
}