Error:Retrieving file information from google docs

Discussion in 'PHP' started by Harish kumara, Feb 21, 2009.

  1. #1
    <html>

    <head>
    <title></title>
    </head>

    <body>

    <?php
    //session_start();
    require_once 'Zend/Loader.php';

    Zend_Loader::loadClass('Zend_Gdata');

    Zend_Loader::loadClass('Zend_Gdata_AuthSub');
    Zend_Loader::loadClass('Zend_Gdata_App_Entry');

    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');


    Zend_Loader::loadClass('Zend_Gdata_Docs');

    global $gdclient,$feed;
    $user = 'abcd@gmail.com';
    $pass = 'xxxxxxxx';
    $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; // predefined service name for Google Documents

    $httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
    $gdClient = new Zend_Gdata_Docs($httpClient);

    function retrieveAllDocuments($gdClient, $html)
    {
    if ($html) {echo "<h2>Your documents</h2>\n";}
    $feed = $gdClient->getDocumentListFeed();
    printDocumentsFeed($feed, $html);
    }

    function printDocumentsFeed($feed, $html)
    {
    if ($html) {echo "<ul>\n";}

    // Iterate over the document entries in the feed and display each document's
    // title.
    foreach ($feed->entries as $entry) {
    if ($html) {
    // Find the URL of the HTML view of the document.
    $alternateLink = '';
    foreach ($entry->link as $link) {
    if ($link->getRel() === 'alternate') {
    $alternateLink = $link->getHref();
    }
    }
    // Make the title link to the document on docs.google.com.
    echo "<li><a href=\"$alternateLink\">\n";
    }
    echo "$entry->title\n";
    // $content=$entry->getContent();
    // echo "$content";
    // $link=$entry->link;
    // echo "$entry->getSource()";
    // $fp=fopen($link->getHref(),"r");
    // echo filemtime($fp);
    if ($html) {echo "</a></li>\n";}
    }
    if ($html) {echo "</ul>\n";}
    }
    retrieveAllDocuments($gdClient, true);
    printDocumentsFeed($feed, true);
    ?>

    </body>

    </html>


    the above code gives the list of documents in google doc could any one give a solution to retrieve the details such as modification time,created time,size......etc., of each document??????
    :confused::confused::confused:
     
    Harish kumara, Feb 21, 2009 IP