Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Oauth 获取用户雅虎电子邮件_Oauth_Yahoo Api - Fatal编程技术网

Oauth 获取用户雅虎电子邮件

Oauth 获取用户雅虎电子邮件,oauth,yahoo-api,Oauth,Yahoo Api,我认为雅虎用户的这封电子邮件对雅虎和推特来说没什么问题 我已经找了很多天了,但是运气不好 我得到了用户的详细信息 print( $profile->location) ; --------got location print( $profile->gender) ; --------- got gender 但是,当我想收到电子邮件时,我却不能 你试过这个吗 print( $profile->emails->handle) ; print( $p

我认为雅虎用户的这封电子邮件对雅虎和推特来说没什么问题

我已经找了很多天了,但是运气不好

我得到了用户的详细信息

  print( $profile->location) ;   --------got location
  print( $profile->gender) ;   --------- got gender
但是,当我想收到电子邮件时,我却不能

你试过这个吗

  print( $profile->emails->handle) ;
 print( $profile->emails['handle']) ; -----no luck
但我犯了这个错误

Notice: Trying to get property of non-object in mywebsite/index.php on line 103
你试过这个吗

  print( $profile->emails->handle) ;
 print( $profile->emails['handle']) ; -----no luck
我看过,但似乎有很多电子邮件

如何获取主电子邮件

谢谢

编辑:

我试过这个

  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)
  }
它给出了这个

 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) 
  } 

能否显示var_dump$profile;的结果;?我已经编辑了,并添加了EDIT2。看来emails数组中不存在句柄!!!