+ its quite ugly to work with zend here

        $client = Zend_Gdata_ClientLogin::getHttpClient($username,
$password, "cp");
        $gdata = new Zend_Gdata($client);
        //$username = 'default'; # either current email or 'default'
        $query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/
contacts/'.$username.'/full');
        $query->setMaxResults(9999);
        $feed = $gdata->getFeed($query);
gets the feed of all contacts
so far so good

a) SimpleXML
        # returns more info than SimpleXMLElement (but array structure is not
easy to work with here)
        App::import('Core', 'Xml');
        $xml = new Xml($feed->getXML(), array('namespaces'=>'http://
schemas.google.com/g/2005'));
        $feed = $xml->toArray();
                                pr($feed);

b) Cake Xml
        # returns only below information (title, email, org, phone, address)
- somehow nothing else!!!
                                $xml = new SimpleXMLElement($feed->getXML());
                                $entries = 
$xml->children('http://www.w3.org/2005/Atom');
                                foreach ($entries->entry as $entry) {
                                  $defaults = 
$entry->children('http://schemas.google.com/g/
2005');
                                  pr($defaults);

                                  echo 'title: '.$entry->title;
                                  echo ' email: 
'.$defaults->email->attributes()->address;
                                  echo ' address: '.$defaults->postalAddress;
                                        echo ' phonenumber: 
'.$entry->phoneNumber;

                                  echo ' org: '.$entry->organization->orgName;
                                        echo ' orgTitle: 
'.$entry->organization->orgTitle;

                                        echo ' im: '.$entry->organization->im;

                                  echo "\n".BR;
                                }


any clue how to get all the data properly?
this would enable a model to actually sync google data with app
data...
right now its more like a huge mess :)

and i start to hate google and its API - seems like they didnt do
their homework
even their import/export doesnt support all the elements a vcard or
csv file would require...


On 12 Feb., 15:35, euromark <[email protected]> wrote:
> i could not find anything on google data API in cake
> zend for example has quite a powerful library build in
>
> wouldnt that be something awesome cake should have too?
> it would then be possible to easily exchange all kinds of information
> with different google APIs.
> i am especially interested in some kind of datasource, lib class or
> component which is able to work on the new "contacts API" in order to
> sync google mail contacts with contacts in my app
>
> re-building the zend framework classes for cake could be a real big
> deal i imagine...
> but we could focus on those few important ones
> might be worth creating a enhancement ticket
>
> or has anyone already built something similar? using core httpsocket
> and xml classes?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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/cake-php?hl=en

Reply via email to