2012-09-24 167 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),謝謝。 –