问题
I think this yahoo email of users is little problem with yahoo and twitter.
I have searched many days for this but no luck.
Im getting user details like that
print( $profile->location) ; --------got location
print( $profile->gender) ; --------- got gender
But when i want to get the email i couldnt .
Have tried this
print( $profile->emails->handle) ;
But i got this error
Notice: Trying to get property of non-object in mywebsite/index.php on line 103
Have tried this
print( $profile->emails['handle']) ; -----no luck
I have seen this but it seems there are many emails .
How can i get the main email ?
Thanks
EDIT:
i have tryed this
foreach($profile->emails as $k){
echo 'handle: ' . $k->handle . ' -----> i got error here 'Undefined property: stdClass::$handle'
id: ' . $k->id . ' -----> i got the id (no error)
type: ' . $k->type . '<br>'; -----> i got the type (no error)
}
i dont know why handle returns error always . is something wrong with handle ?
EDIT2:
i have made this:
var_dump($profile);
and it gives this
object(stdClass)#14 (20)
{ ["uri"]=> string(70)
"http://social.yahooapis.com/v1/user/1JKK3SDVWE6QDPAQRVUFRN7NDU/profile"
["guid"]=> string(26) "1J4K3SDVSW6QDPQQRVU1RN7NDO"
["birthYear"]=> int(1977)
["birthdate"]=> string(3) "12/8"
["created"]=> string(20) "2006-10-08T10:32:21Z"
["displayAge"]=> int(37)
["emails"]=> array(1) { [0]=> object(stdClass)#22 (3) { ["id"]=> int(3)
["primary"]=> bool(true)
["type"]=> string(4) "HOME"} }
["familyName"]=> string(0) ""
["gender"]=> string(1) "M"
["givenName"]=> string(0) ""
["image"]=> object(stdClass)#23 (4) { ["height"]=> int(192)
["imageUrl"]=> string(55) "http://l.yimg.com/dh/ap/social/profile/profile_U197.png"
["size"]=> string(7) "192x192"
["width"]=> int(192) }
["lang"]=> string(5) "en-UK"
["location"]=> string(31) "NA, Indisponible ENGLAND 16548"
["memberSince"]=> string(20) "2003-05-10T21:34:41Z"
["nickname"]=> string(5) "diFirst"
["profileUrl"]=> string(51) "http://profile.yahoo.com/1J4K3SDVSE6ADPQQRVJFRN7ND1" ["searchable"]=> bool(true)
["timeZone"]=> string(12) "Europe/ENGLAND"
["updated"]=> string(20) "2012-09-21T14:35:30Z"
["isConnected"]=> bool(false)
}
来源:https://stackoverflow.com/questions/21211266/get-users-yahoo-email