title: Php gcal class Not working
body: <p>Iam using a php class to add event to google calender.But the class return an error when loading index.php page.</p>
  
  <p>This is the code in index.php page here iam calling class:</p>
  
  <pre><code>&lt;?php
  require_once('gcal.class.php');
  $g = new gcal('test@gmail.com','test123$'); 
  $cal_url = 'https://www.google.com/calendar/feeds/test@gmail.com/private-01d281d910a2622c8c2f5899690b9eb5/basic'; 
  $eTitle = 'test event'; $eDesc = 'Another Test'; $eAuthorName = 'Justin Burger'; $eAuthorEmail = 'justin@loudisrelative.com'; $eLocation = 'LIR Offices'; $eStartTime = date('c'); $eEndTime = date('c',strtotime("+1 hour")); 
  
  //Adding an event.
  $g-&gt;addEvent($cal_url,$eTitle, $eDesc, $eAuthorName, $eAuthorEmail,$eLocation,$eStartTime, $eEndTime); 
  
  ?&gt;
  </code></pre>
  
  <p>And this is the gcal.class.php code :</p>
  
  <pre><code> &lt;?php
  require_once('HTTP/Request.php');
  
      class gcal{
          /** Google Auth Token, used to authorize add functions*/
          private $token;
  
          /** Users Email Address (notice, password is not stored) */
          private $email;
          function __construct($email, $password){
              $this-&gt;login($email,$password); 
              $this-&gt;email = $email;      
          }
          public function addEvent($cal_url,$eTitle, $eDesc, $eAuthorName, $eAuthorEmail,$eLocation,$eStartTime, $eEndTime){
              /* Make sure we send ONLY valid XML. */
              $eTitle         = htmlentities($eTitle);
              $eDesc          = htmlentities($eDesc);
              $eAuthorName    = htmlentities($eAuthorName);
              $eAuthorEmail   = htmlentities($eAuthorEmail);
              $eLocation      = htmlentities($eLocation);
              $eStartTime     = htmlentities($eStartTime);
              $eEndTime       = htmlentities($eEndTime);
  
               $xml = "&lt;entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'&gt;
                  &lt;category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'&gt;&lt;/category&gt;
                  &lt;title type='text'&gt;{$eTitle}&lt;/title&gt;
                  &lt;content type='text'&gt;{$eDesc}&lt;/content&gt;
                  &lt;author&gt;
                      &lt;name&gt;{$eAuthorName}&lt;/name&gt;
                      &lt;email&gt;{$eAuthorEmail}&lt;/email&gt;
                  &lt;/author&gt;
                  &lt;gd:transparency value='http://schemas.google.com/g/2005#event.opaque'&gt;&lt;/gd:transparency&gt;
                  &lt;gd:eventStatus
                      value='http://schemas.google.com/g/2005#event.confirmed'&gt;
                  &lt;/gd:eventStatus&gt;
                  &lt;gd:where valueString='{$eLocation}'&gt;&lt;/gd:where&gt;
                  &lt;gd:when startTime='{$eStartTime}'
                      endTime='{$eEndTime}'&gt;&lt;/gd:when&gt;
              &lt;/entry&gt;";
  
              $http = new HTTP_Request($cal_url,array('allowRedirects' =&gt; true));
              $http-&gt;setMethod('POST');
              $http-&gt;addHeader('Host','www.google.com');
              $http-&gt;addHeader('MIME-Version','1.0');
              $http-&gt;addHeader('Accept','text/xml');
              $http-&gt;addHeader('Content-type','application/atom+xml');
              $http-&gt;addHeader('Authorization','GoogleLogin auth=' . $this-&gt;token);
              $http-&gt;addHeader('Content-length',strlen($xml));
              $http-&gt;addHeader('Cache-Control','no-cache');
              $http-&gt;addHeader('Connection','close');
              $http-&gt;setBody($xml);
              $http-&gt;sendRequest();
  
              switch($http-&gt;getResponseCode()){
                  case 201: case 200:
                      return true;
                      break;
                  default:
                      throw new Exception('Error Adding Google Cal Event. Response From Google:' . $http-&gt;getResponseBody(), $http-&gt;getResponseCode());
                      return false;
                      break;  
              }
  
          }
  
          public function getCalendarList(){
              $url = 'http://www.google.com/calendar/feeds/' . $this-&gt;email;
  
              $http = new HTTP_Request($url,array('allowRedirects' =&gt; true));
              $http-&gt;addHeader('Authorization','GoogleLogin auth=' . $this-&gt;token);
              $http-&gt;setMethod('GET');
              $http-&gt;sendRequest();
              $xml = new SimpleXMLElement($http-&gt;getResponseBody());
  
              $calendars = array();
              foreach ($xml-&gt;entry as $cal){
  
                  foreach($cal-&gt;link as $key=&gt;$link){
                      $linkSets = array();
                      $links = $link-&gt;attributes();
                      $links = (array) $links;
                      foreach($links as $l){
                          $linkSets[] = array('rel'=&gt;$l['rel'],
                                              'type'=&gt;$l['type'],
                                              'href'=&gt;$l['href']);
                      }
                  }
                  $calendars[] = array('id'=&gt;strval($cal-&gt;id),
                                       'published'=&gt;strval($cal-&gt;published),
                                       'updated'=&gt;strval($cal-&gt;updated),
                                       'title'=&gt;strval($cal-&gt;title),
                                       'authorName'=&gt;strval($cal-&gt;author-&gt;name),
                                       'authorEmail'=&gt;strval($cal-&gt;author-&gt;email),
                                       'links'=&gt;$linkSets);
              }
              return $calendars;
          }
          private function login($email, $password){
              $url = 'https://www.google.com/accounts/ClientLogin';
  
  
              $http = new HTTP_Request('https://www.google.com/accounts/ClientLogin',
                                       array('allowRedirects' =&gt; true));
              $http-&gt;setMethod('POST');
              $http-&gt;addPostData('Email', $email);
              $http-&gt;addPostData('Passwd', $password);
              $http-&gt;addPostData('source', 'example-test-2');
              $http-&gt;addPostData('service', 'cl');
              $http-&gt;addPostData('accountType', 'HOSTED_OR_GOOGLE');
              $http-&gt;sendRequest();
  
              switch($http-&gt;getResponseCode()){
                  case 403:
                      throw new Exception('Google Auth Failed',403);
                      break;
                  case 200: case 201:
                      $this-&gt;token = $this-&gt;extractAuth($http-&gt;getResponseBody());
                      return true;
                      break;
                  default:
                      throw new Exception('Unknown Google Auth Failure',$http-&gt;getResponseCode());
                      break;  
              }
          }
  
          private function extractAuth($body){
              $st = strpos($body,'Auth=');
              $token = trim(substr($body,($st+5)));
              return $token;
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>Then iam taking this in browser it displays error:</p>
  
  <pre><code>Warning: require_once(HTTP/Request.php) [function.require-once]: failed to open stream: No such file or directory in E:\wamp\www\gcal\gcal.class.php on line 2
  Fatal error: require_once() [function.require]: Failed opening required 'HTTP/Request.php' (include_path='.;C:\php\pear') in E:\wamp\www\gcal\gcal.class.php on line 2
  </code></pre>
  
  <p>What is the problem in my code?</p>
  
  <p>When i downloading the class from google code they said that please make sure you have both installed before use (for example: pear install Net and pear install HTTP) .
  I dont know how to do this?Give me a solution.</p>