Hoping for newbe help with this Zend script (Google API)

Reply

Join Date: Apr 2009
Posts: 34
Reputation: mbirame is an unknown quantity at this point 
Solved Threads: 0
mbirame mbirame is offline Offline
Light Poster

Hoping for newbe help with this Zend script (Google API)

 
0
  #1
Jul 13th, 2009
Hi folks,
I am still quite new here, and brand new to Zend and PHP, so please forgive my ignorance...I'm sadly still very much a paint by numbers hack. :-D

I'm wanting to do what I think is a fairly simple task:

Collect info from one of my google calendars via the API and display that info in a table on a page on my website.

I have succesfully installed Zend and I have used this code to access my google calendar:

<?php
    // load library
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
    Zend_Loader::loadClass('Zend_Http_Client');

    // create authenticated HTTP client for Calendar service
    $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
    $user = "EMAIL@GMAIL.COM";
    $pass = "XXXXXXXXX";
    $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
    $gcal = new Zend_Gdata_Calendar($client);

    // generate query to get event list
    $query = $gcal->newEventQuery();
    $query->setUser('default');
    $query->setVisibility('private');
    $query->setProjection('basic');

    // get and parse calendar feed
    // print output
    try {
      $feed = $gcal->getCalendarEventFeed($query);
    } catch (Zend_Gdata_App_Exception $e) {
      echo "Error: " . $e->getResponse();
    }
    ?>
    <h1><?php echo $feed->title; ?></h1>
    <?php echo $feed->totalResults; ?> event(s) found.
    <p/>
    <ol>

    <?php
    foreach ($feed as $event) {
      echo "<li>\n";
      echo "<h2>" . stripslashes($event->title) . "</h2>\n";
      echo stripslashes($event->summary) . " <br/>\n";
      echo "</li>\n";
    }
    echo "</ul>";
    ?>

This gives me my default calendar information, but:
1) I want to be able to choose which calendar to display.
2) I want to be able to display the information in different columns, etc

Anyone able to point me in the right direction?

Thanks for your time!
Joel
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 485 | Replies: 0
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC