我正在尝试使用代码中的Yahoo OAuth获取联系人详细信息。 OAuth工作正常,我从雅虎获得以下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;
有谁能帮助我,我在这里做错了什么?这是雅虎的标准代码,我没有做任何事情。
答案 0 :(得分:2)
应为$prfurl = $profile->profile->profileUrl;