我想使用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;
}
但是$ contact是emty,我没有想法帮助
答案 0 :(得分:1)
您可以通过这种方式看到响应 $ response = $ user-&gt; getContacts(); 后续代码var_dump($响应); 并找到你的问题