如何使用Yahoo API PHP查找Yahoo电子邮件地址

如何使用Yahoo API PHP查找Yahoo电子邮件地址,php,email,sdk,yahoo-api,Php,Email,Sdk,Yahoo Api,这就是我的困境 目前正在将Yahoo API与PHP结合使用,以便在我的网站上使用“使用Yahoo登录”功能 我已成功检索到我的整个个人资料。问题是,我无法直接显示与该帐户关联的主要电子邮件 如果我使用print\r($profile)我会从我的个人资料中转储所有内容。看起来是这样的(个人数据已删除): stdClass对象([uri]=>*********/profile[guid]=>******[birthdate]=>/[created]=>2010-04-22T20:47:48Z[e

这就是我的困境

目前正在将Yahoo API与PHP结合使用,以便在我的网站上使用“使用Yahoo登录”功能

我已成功检索到我的整个个人资料。问题是,我无法直接显示与该帐户关联的主要电子邮件

如果我使用
print\r($profile)
我会从我的个人资料中转储所有内容。看起来是这样的(个人数据已删除):


stdClass对象([uri]=>*********/profile[guid]=>******[birthdate]=>/[created]=>2010-04-22T20:47:48Z[emails]=>Array([0]=>stdClass对象([handle]=>@gmail.com[id]=>1[type]=>HOME][1]=>stdClass对象([handle]=>=>1[type]=>HOME]=>familyName]=>姓氏[gender]=>M[givenName]=>Ricki[image]=>stdClass对象([height]=>192[imageUrl]=>[size]=>192x192[width]=>192[lang]=>en-US[MemberBefore]=>2010-04-08T11:22:56Z[昵称]=>Ricki[profileUrl]=>

然而,使用
$profile->email->handle
不会产生任何效果。有什么办法吗?我可以使用
$profile->emails
,它返回一个数组,简单地显示为“Array”,但是如果我尝试从数组中选择,我会得到一个错误:

“可捕获的致命错误:类stdClass的对象无法转换为字符串”


有人吗

$profile->emails[0]->handle
将为您提供系统中的第一个句柄


你也可以做
foreach($profile->email as$email){print$email->handle;}

很好,我就快到了,但这对我帮助很大!!

stdClass Object ( [uri] => http://social.yahooapis.com/v1/user/*********/profile [guid] => ***** [birthdate] => / [created] => 2010-04-22T20:47:48Z [emails] => Array ( [0] => stdClass Object ( [handle] => **@gmail.com [id] => 1 [type] => HOME ) [1] => stdClass Object ( [handle] => ****@yahoo.com [id] => 2 [primary] => 1 [type] => HOME ) ) [familyName] => Surname [gender] => M [givenName] => Ricki [image] => stdClass Object ( [height] => 192 [imageUrl] => http://l.yimg.com/dh/ap/social/profile/profile_b192.png [size] => 192x192 [width] => 192 ) [lang] => en-US [memberSince] => 2010-04-08T11:22:56Z [nickname] => Ricki [profileUrl] => http://profile.yahoo.com/*********** [updated] => 2013-03-03T18:12:22Z [isConnected] => )