2012-09-24 124 views
0

我想在我的代码中使用雅虎OAuth获取联系人详细信息。基于OAuth的认证工作正常,我从雅虎得到以下stdClass的:PHP stdClass - 雅虎OAuth

stdClass Object ( 
    [profile] => stdClass Object ( 
      [guid] => AA5JFPBIASDFFESAETKHA 
      [birthYear] => 1980 
      [birthdate] => 1/31 
      [created] => 2008-10-08T13:59:36Z 
      [displayAge] => 32 
      [gender] => M 
      [image] => stdClass Object ( 
       [height] => 192 
       [imageUrl] => http://socialprofiles.zenfs.com/images/636fb037c2791a06fda15adda78b38f0_192.jpg 
       [size] => 192x192 [width] => 192 
      ) 
      [location] => Noida, India 
      [memberSince] => 2002-03-04T11:38:32Z 
      [nickname] => Himanshu 
      [profileUrl] => http://profile.yahoo.com/AA5JFPBIZUNNQRHEA6R73NTKHA 
      [status] => stdClass Object (
        [lastStatusModified] => 2011-10-27T17:03:35Z 
        [linkTo] => 
        [message] => Using Yahoo! mail after a long time.... Full of features that Gmail cannot come anywhere close to.....) 
        [isConnected] => false 
        ) 

这是我的脚本的164行中的变量$配置文件的print_r的。现在,当我想在我的程序来使用这个变量,它给我这样的错误:

Notice: Undefined property: stdClass::$profileUrl in /var/www/vhosts/xyz.com/httpdocs/PHP/yahoo-api-php-client/examples/simpleauth/simpleauth.php on line 165 

线165在我的PHP脚本$prfurl = $profile->profileUrl;

谁能帮我我在做什么错这里?这是雅虎的标准代码,我没有做任何事情。

回答

2

应该$prfurl = $profile->profile->profileUrl;

+0

由于一吨....这真的帮助。我现在能够获得详细信息。 –

+0

你可以看看我的[问题](http://stackoverflow.com/questions/21211266/get-users-yahoo-email),谢谢。 –