Body->Contacts->Object); $i++) { $x = &$xml->Body->Contacts->Object[$i]; echo $x->Name.', '.$x->Emails->Object->Address[0]."\n"; } function getGmailContacts($Username, $Password, &$Err) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_POST, TRUE); curl_setopt ($ch, CURLOPT_HEADER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "HostPC"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt ($ch, CURLOPT_REFERER, ""); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ch, CURLOPT_MAXREDIRS, 5); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt ($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_COOKIESESSION, TRUE); # PHP5 only curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_URL, "https://www.google.com/accounts/LoginAuth?continue=http%3A%2F%2Fwww.google.com%2F&hl=en"); $Data = ""; $Data .= "continue=".urlencode("http://www.google.com/")."&"; $Data .= "nui=13&"; $Data .= "Email=".urlencode($Username)."&"; $Data .= "Passwd=".urlencode($Password)."&"; // $Data .= "PersistentCookie=Yes&"; $Data .= "rmShown=1&"; $Data .= "signIn=Sign+in&"; curl_setopt ($ch, CURLOPT_POSTFIELDS, $Data); $contents = curl_exec($ch); $ErrNo = curl_errno($ch); if ($ErrNo != 0) { $Err[] = "cURL Error @ Login :: Error No: ".curl_errno($ch).' : '.curl_error($ch); return FALSE; } if ($contents == NULL) { $Err[] = "contents == NULL @ Login"; return FALSE; } curl_setopt ($ch, CURLOPT_POST, FALSE); $url = "http://www.google.com/notebook/contacts"; curl_setopt ($ch, CURLOPT_URL, $url); $contents = curl_exec($ch); $ErrNo = curl_errno($ch); if ($ErrNo != 0) { $Err[] = "cURL Error @ Contacts :: Error No: ".curl_errno($ch).' : '.curl_error($ch); return FALSE; } if ($contents == NULL) { $Err[] = "contents == NULL @ Contacts"; return FALSE; } return $contents; } ?>