首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gravatar执行概要请求

Gravatar执行概要请求
EN

Stack Overflow用户
提问于 2013-09-07 17:57:33
回答 1查看 166关注 0票数 0

我正在尝试从Gravatar检索信息到我的Joomla。我是成功地检索我的形象从凹印头像,但我正在努力检索其他个人资料。

代码语言:javascript
复制
  $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也有点陌生。

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-08 06:54:40

对不起,我完全误解了你的问题:-D

如果用户自己设置了IMs、电子邮件和电话之类的值,就可以使用它们。请记住,$profile['entry'][0]['ims']是一个数组,其键从零到数组长度减一。

代码语言:javascript
复制
echo $profile['entry'][0]['emails'][0]['value'];
echo $profile['entry'][0]['ims'][0]['value']  ;
echo $profile['entry'][0]['ims'][0]['type']  ;

ims数组如下所示:

代码语言:javascript
复制
  ["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"
    }
  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18676251

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档