Guest User

Untitled

a guest
Aug 29th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <?php
  2.  
  3. function retrieveAllDocuments($gdClient, $html)
  4. {
  5. if ($html) {echo "<h2>Your documents</h2>\n";}
  6. $feed = $gdClient->getDocumentListFeed();
  7. printDocumentsFeed($feed, $html);
  8. }
  9.  
  10. function printDocumentsFeed($feed, $html)
  11. {
  12. if ($html) {echo "<ul>\n";}
  13.  
  14. // Iterate over the document entries in the feed and display each document's
  15. // title.
  16. foreach ($feed->entries as $entry) {
  17. if ($html) {
  18. // Find the URL of the HTML view of the document.
  19. $alternateLink = '';
  20. foreach ($entry->link as $link) {
  21. if ($link->getRel() === 'alternate') {
  22. $alternateLink = $link->getHref();
  23. }
  24. }
  25. // Make the title link to the document on docs.google.com.
  26. echo "<li><a href=\"$alternateLink\">\n";
  27. }
  28. echo "$entry->title\n";
  29. if ($html) {echo "</a></li>\n";}
  30. }
  31. if ($html) {echo "</ul>\n";}
  32. }
  33.  
  34. set_include_path('ZendGdata-1.11.2/library/');
  35.  
  36. require_once('Zend/Loader.php');
  37. //require_once('ZGdata/Entry.php');
  38. require_once('Zend/Gdata/ClientLogin.php');
  39. require_once('Zend/Gdata/Docs.php');
  40. require_once('Zend/Gdata/Docs/DocumentListEntry.php');
  41.  
  42. $user = 'ionut';
  43. $pass = '';
  44. $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; // predefined service name for Google Documents
  45.  
  46. $httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
  47. $gdClient = new Zend_Gdata_Docs($httpClient);
  48.  
  49.  
  50. retrieveAllDocuments($gdClient, TRUE);
  51.  
  52.  
  53. $user = 'morion4000';
  54. $pass = '';
  55. $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; // predefined service name for Google Documents
  56.  
  57. $httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
  58. $gdClient = new Zend_Gdata_Docs($httpClient);
  59.  
  60.  
  61. retrieveAllDocuments($gdClient, TRUE);
  62.  
  63. ?>
Add Comment
Please, Sign In to add comment