Thanks! That really helped...now if only someone knew how to access
the other field, I would be all done.

On Mar 15, 3:43 am, Ian Rogers <[email protected]> wrote:
> The note is the "content" of the entry itself. So in your  foreach
> ($feed as $entry){  loop
>
> if ($entry->content) {
>     echo 'Note: ', $entry->content->text, '<br/>';
>
> }
>
> I don't know about any others as I've only needed to access notes and
> emails in my app.
>
> Ian
>
> 2009/3/15 Fletch <[email protected]>:
>
>
>
> > I have pieced together this code that basically prints a lot of the
> > information I will need to use later, I can get all the elements like
> > name, company, title, email, phone, address, im, group...this is all
> > in the case statement toward the end. My problem is for the life of me
> > I cannot figure out how to access notes and other fields...if anyone
> > has tips on how to access them through the xml feed it would be much
> > appreciated.
>
> > set_include_path('.:usr/local/php5/lib/php:/home/content/f/z/f/
> > fzfowler/html/ZendGdata-1.7.6/library');
>
> > require_once('Zend/Loader.php');
>
> > Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
> > Zend_Loader::loadClass('Zend_Gdata');
> > Zend_Loader::loadClass('Zend_Gdata_Query');
> > Zend_Loader::registerAutoload();
>
> > function GetCategoryFromURL($URL){
> >        return substr($URL, strpos($URL, '#') + 1);
> > }
> > function Connect(){
> >        session_start();
> >                $self = 'http://' . $_SERVER['SERVER_NAME'] . 
> > $_SERVER['PHP_SELF'];
> >                if (isset($_GET['token'])) {
> >                        $_SESSION['contact_token'] =
> > Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
> >                        header('Location: ' . $self);
> >                        exit;
> >                }
>
> >                if (!isset($_SESSION['contact_token'])) {
> >                        $scope = 'http://www.google.com/m8/feeds';
> >                        $uri = Zend_Gdata_AuthSub::getAuthSubTokenUri($self, 
> > $scope, 0, 1);
> >                        header('Location: ' . $uri);
> >                        exit;
> >                }
> >        $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION
> > ['contact_token']);
> >        return $client;
> > }
> > function GetFeed($client){
> >        $scope = "http://www.google.com/m8/feeds/contacts/default/";;
> >        $gdata = new Zend_Gdata($client);
> >        $query = new Zend_Gdata_Query("http://www.google.com/m8/feeds/
> > contacts/default/".'full');
> >        $query->setMaxResults(10000);
> >        $feed = $gdata->retrieveAllEntriesForFeed($gdata->getFeed
> > ($query));
> >                return $feed;
> > }
> > function GoogleContactsAll($feed){
> >        print($feed);
> >        $xml = new SimpleXMLElement($feed->getXML());
> >        $entries = $xml->children('http://www.w3.org/2005/Atom');
> >        print("<br/><br/>");
> >        foreach ($entries->entry as $entry ) {
> >                $defaults = 
> > $entry->children('http://schemas.google.com/g/2005');
> >                echo $defaults."<br/>";
> >                echo 'title: '. $entry->title;
> >                echo ' email: '.$defaults->email->attributes()->address;
> >                echo ' address: '.$defaults->extendedProperty;
>
> >                echo "\n";
> >        }
>
> >        foreach ($feed as $entry){
> >                $contactName = $entry->title->text;
> >                print($contactName);
> >                $ext = $entry->getExtensionElements();
> >                foreach($ext as $extension){
> >                        print($extension);
> >                        $element = $extension->getDOM();
>
> >                        $relURL = $element->getAttribute('rel');
> >                        $printURL = GetCategoryFromURL($relURL);
> >                        print("<br/>".$printURL."::");
>
> >                        print($element->getAttribute('value'));
> >                        print("###".$extension->rootElement."###");
>
> >                        switch($extension->rootElement){
> >                                case 'organization':
> >                                        
> > $attr=$extension->getExtensionElements();
> >                                        if($attr[0]->rootElement == 
> > "orgName"){
> >                                        $contactJob = $attr[0]->text;
> >                                        print($contactJob."<br/><br/>");
> >                                        }
> >                                        if($attr[1]->rootElement == 
> > "orgTitle"){
> >                                        $contactPos = $attr[1]->text;
> >                                        print($contactPos."<br/><br/>");
> >                                        }
> >                                        break;
> >                                case 'email':
> >                                        $attr = 
> > $extension->getExtensionAttributes();
> >                                        $contactMail = 
> > $attr['address']['value'];
> >                                        print($contactMail."<br/><br/>");
> >                                        break;
> >                                case 'phoneNumber':
> >                                        $contactPhone = $extension->text;
> >                                        print($contactPhone."<br/><br/>");
> >                                        break;
> >                                case 'postalAddress':
> >                                        $contactAddr = $extension->text;
> >                                        print($contactAddr."<br/><br/>");
> >                                case 'im':
> >                                        $attr = 
> > $extension->getExtensionAttributes();
> >                                        $contactIM = 
> > $attr['address']['value'];
> >                                        $IMType = 
> > getCategoryFromURL($attr['protocol']['value']);
> >                                        
> > print($IMType.":".$contactIM."<br/><br/>");
> >                                        break;
> >                                case 'groupMembershipInfo':
> >                                        $UrlGroup = 
> > $extension->extensionAttributes['href']['value'];
> >                                        $arrGroupEx = explode("/",$UrlGroup);
> >                                        $contactGrp = 
> > $arrGroupEx[(count($arrGroupEx)-1)];
>
> >                        }
> > }
> > GoogleContactsAll(GetFeed(Connect()));
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to