Oauth 使用yahoo api获取联系人列表

Oauth 使用yahoo api获取联系人列表,oauth,yahoo-api,Oauth,Yahoo Api,我想使用yahoo api获取用户yahoo联系人,并在页面中显示我的代码: // if a session is initialized, fetch the user's profile information if($session) { // Get the currently sessioned user. $user = $session->getSessionedUser(); //var_dump($user); // Load

我想使用yahoo api获取用户yahoo联系人,并在页面中显示我的代码:

// if a session is initialized, fetch the user's profile information
    if($session) {
    // Get the currently sessioned user.
      $user = $session->getSessionedUser();
    //var_dump($user);

    // Load the profile for the current user.
    $profile = $user->getProfile();
    $profile_contacts=XmltoArray($user->getContactSync());
    var_dump( $profile_contacts);
    $contacts=array();
    foreach($profile_contacts['contactsync']['contacts'] as $key=>$profileContact){
      foreach($profileContact['fields'] as $contact){
        $contacts[$key][$contact['type']]=$contact['value'];
       }
     }
  //echo "<pre/>";
  //print_r($contacts);exit; 
  }
//如果会话已初始化,则获取用户的配置文件信息
如果($会议){
//获取当前正在会话的用户。
$user=$session->getSessionedUser();
//var_dump($user);
//加载当前用户的配置文件。
$profile=$user->getProfile();
$profile_contacts=XmltoArray($user->getContactSync());
变量转储($profile\u contacts);
$contacts=array();
foreach($profile_contacts['contactsync']['contacts']as$key=>$profileContact){
foreach($profileContact['fields']作为$contact){
$contacts[$key][$contact['type']]=$contact['value'];
}
}
//回声“;
//打印($contacts);退出;
}

但是$contact是emty,我没有想法帮助请

您可以通过这种方式查看响应 $response=$user->getContacts(); Var_dump($response); 找到你的问题