0

我正在尝试在我的代码中使用 Yahoo OAuth 获取联系方式。OAuth 工作正常,我从 Yahoo 获得以下 stdClass:

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 行上变量 $profile 的 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

我的 php 脚本中的第 165 行是$prfurl = $profile->profileUrl;

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

4

1 回答 1

2

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

于 2012-09-24T08:22:09.550 回答