我正在尝试从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'];
?> 下面的代码在gravatar文档中,它只输出我的凹版名称。如何获得其他必要的资料?!我对PHP也有点陌生。
谢谢。
发布于 2013-09-08 06:54:40
对不起,我完全误解了你的问题:-D
如果用户自己设置了IMs、电子邮件和电话之类的值,就可以使用它们。请记住,$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"
}
}https://stackoverflow.com/questions/18676251
复制相似问题