daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. echo $event->getEditLink()->href;
  2.    
  3. function add_gcal($title, $date, $desc){
  4.  
  5. $newIncludePath = array();
  6. $newIncludePath[] = '../ZendGdata-1.8.4PL1/library';
  7. $newIncludePath = implode($newIncludePath);
  8. set_include_path($newIncludePath);
  9.  
  10.   // load classes
  11.   require_once 'Zend/Loader.php';
  12.   Zend_Loader::loadClass('Zend_Gdata');
  13.   Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
  14.   Zend_Loader::loadClass('Zend_Gdata_Calendar');
  15.   Zend_Loader::loadClass('Zend_Http_Client');
  16.  
  17.   // connect to service
  18.   $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
  19.   $user = "------@gmail.com";
  20.   $pass = "------";
  21.   $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
  22.   $gcal = new Zend_Gdata_Calendar($client);
  23.  
  24.   // construct event object
  25.   // save to server      
  26.   try {
  27.     $event = $gcal->newEventEntry();        
  28.     $event->title = $gcal->newTitle($title);
  29.     $event->content = $gcal->newContent($desc);      
  30.     $when = $gcal->newWhen();
  31.     $when->startTime = $date;
  32.     $when->endTime = $date;
  33.     $event->when = array($when);        
  34.     $gcal->insertEvent($event);  
  35.  
  36.     echo $event->getEditLink()->href;
  37.  
  38.   } catch (Zend_Gdata_App_Exception $e) {
  39.     echo "Error: Unable to add event to Google Calendar" . $e->getResponse();
  40.   }
  41.    
  42. $newEvent->when = array($when);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top