Hi Nicolae, There is an error on your feed Url, to get the contacts feed it should be "/contacts/" instead of "/groups/":
$query = new Zend_Gdata_Query( "http://www.google.com/m8/feeds/ contacts/default/full"); Please let me know if that does not solve the issue. -Julian. On Mar 31, 3:49 pm, darie nicolae <[email protected]> wrote: > The information is not there : this is my code : > > <?php > > $clientLibraryPath = '/Users/nicolaedarie/Sites/ZendGdata/library/'; > set_include_path(get_include_path() . PATH_SEPARATOR . > $clientLibraryPath); > > include($clientLibraryPath . '/Zend/Loader.php'); > > Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); > Zend_Loader::loadClass('Zend_Gdata_Gapps'); > Zend_Loader::loadClass('Zend_Gdata_Query'); > > $username="[email protected]"; > $pass="pass"; > $client = Zend_Gdata_ClientLogin::getHttpClient($username, $pass, > "cp"); > $username = str_replace("@","%40",$username); > $gdata = new Zend_Gdata($client); > $query = new Zend_Gdata_Query( "http://www.google.com/m8/feeds/groups/ > default/full"); > $query->setMaxResults( 100 ); > $feed = $gdata->getFeed( $query ); > > $groupId = 'http://www.google.com/m8/feeds/groups/varzariu.nicolae > %40gmail.com/base/2842a9b10e7d48bb'; > > foreach ($feed->getEntry() as $entry ) { > $newExtensionElements = array(); > > print_r($entry->getExtensionElements()); > > foreach ( $entry->getExtensionElements() as $extensionElement ) { > > $domElement = $extensionElement->getDom(); > echo 'tag name : ' . '<br>'; > > if ( !($domElement->tagName == 'groupMembershipInfo' and > $domElement->getAttribute( 'href' ) == $groupId) ) { > echo 'tag name : ' . $domElement->tagName; > array_push($newExtensionElements, $extensionElement ); > } > } > print_r( $newExtensionElements ); > $entry->setExtensionElements( $newExtensionElements ); > $entry->save(); > > } > > So why the $entry->getExtensionElements() is empty? > > Regards, > Nicolae > > ?> > > On Mar 31, 11:27 am, "Julian (Google)" <[email protected]> wrote: > > > Hi, > > > Just in case, check that you have the path and the imports: > > > $clientLibraryPath = '/var/www/contacts/Zend'; > > $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . > > $clientLibraryPath); > > require_once 'Loader.php'; > > Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); > > Zend_Loader::loadClass('Zend_Gdata'); > > Zend_Loader::loadClass('Zend_Gdata_Query'); > > > Maybe you can try a print_r( $entry->getExtensionElements() ); to > > double check that there is information there. > > > -Julian > > > On Mar 30, 10:09 pm, darie nicolae <[email protected]> wrote: > > > > Hey there, thanks for the quick response, ive tested the code but it > > > doesnt work! i got the main idea of how it works, but if i put echo > > > 'something'; inside foreach ( $entry->getExtensionElements() as > > > $extensionElement ) , the echo doesnt get displayed, that means the > > > code doesnt get executed in that foreach. > > > > Let me know if i do a mistake. > > > Thanks > > > > On Mar 30, 5:19 pm, "Julian (Google)" <[email protected]> wrote: > > > > > Hi, > > > > > You can remove the appropriate Extension Element for the Entry, for > > > > example the following code iterates over all Entries and removes them > > > > from one Group: > > > > > $client = Zend_Gdata_ClientLogin::getHttpClient("[email protected]", > > > > "PASWORD", "cp"); > > > > $gdata = new Zend_Gdata($client); > > > > $query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/ > > > > user%40domain.com/full'); > > > > $query->setMaxResults(1000); > > > > $feed = $gdata->getFeed($query,Zend_Gdata_App_Feed); > > > > > // Group ID to Remove: > > > > $groupId = 'http://www.google.com/m8/feeds/groups/user%40domain.com/ > > > > base/7d60cf6309868fc6'; > > > > > foreach ($feed->getEntry() as $entry ) { > > > > $newExtensionElements = array(); > > > > foreach ( $entry->getExtensionElements() as $extensionElement ) { > > > > $domElement = $extensionElement->getDom(); > > > > if ( !($domElement->tagName == 'groupMembershipInfo' and > > > > $domElement->getAttribute( 'href' ) == $groupId )) { > > > > array_push($newExtensionElements, $extensionElement ); > > > > } > > > > } > > > > #print_r( $newExtensionElements ); > > > > $entry->setExtensionElements( $newExtensionElements ); > > > > $entry->save(); > > > > > } > > > > > You can find more information about Gdata_App_Base and > > > > Gdata_App_Extension_Element in the following > > > > links:http://framework.zend.com/apidoc/core/Zend_Gdata/App/Zend_Gdata_App_B...... > > > > > Cheers, > > > > Julian. > > > > > On Mar 28, 11:57 pm, darie nicolae <[email protected]> wrote: > > > > > > Hello, > > > > > > My question is how do i delete a contact from a group, through PHP? > > > > > > Thanks. > > > > > On Mar 28, 11:57 pm, darie nicolae <[email protected]> wrote: > > > > > > Hello, > > > > > > My question is how do i delete a contact from a group, through PHP? > > > > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
