Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function searchEvents(CultureFeed_Uitpas_Event_Query_SearchEventsOptions $query)
 {
     $data = $query->toPostData();
     //$data['email'] = "*****@*****.**";
     $result = $this->oauth_client->consumerGetAsXml('uitpas/cultureevent/search', $data);
     //dpm( $data );
     //dpm( $result );
     try {
         $xml = new CultureFeed_SimpleXMLElement($result);
     } catch (Exception $e) {
         throw new CultureFeed_ParseException($result);
     }
     $events = array();
     $objects = $xml->xpath('/cultureEvents/event');
     $total = $xml->xpath_int('/cultureEvents/total');
     foreach ($objects as $object) {
         $events[] = CultureFeed_Uitpas_Event_CultureEvent::createFromXML($object);
     }
     return new CultureFeed_ResultSet($total, $events);
 }
}
spl_autoload_register('culturefeed_autoload');
try {
    $endpoint = $_SERVER['argv'][1];
    //http://uitpas-acc.lodgon.com:8080/uitid/rest/
    $consumer_key = $_SERVER['argv'][2];
    // 62510a93c4754ed7306113e0f2391c82
    $consumer_secret = $_SERVER['argv'][3];
    // beea3e641e184c4a4bf3272ef4dcedf7
    $searchparms = $_SERVER['argv'][4];
    // "startDate=2012-09-1&endDate=2012-09-31&max=5"
    $path = "/uitpas/cultureevent/search";
    $oc = new CultureFeed_DefaultOAuthClient($consumer_key, $consumer_secret);
    $oc->setEndpoint($endpoint);
    $c = new CultureFeed($oc);
    $query = new CultureFeed_Uitpas_Event_Query_SearchEventsOptions();
    $query->readQueryString($searchparms);
    $data = $c->uitpas()->searchEvents($query);
    print_r($data);
} catch (Exception $e) {
    $eol = PHP_EOL;
    $type = get_class($e);
    print "An exception of type {$type} was thrown." . PHP_EOL;
    print "Code: {$e->getCode()}" . PHP_EOL;
    if ($e instanceof CultureFeed_Exception) {
        print "CultureFeed error code: {$e->error_code}" . PHP_EOL;
    }
    print "Message: {$e->getMessage()}" . PHP_EOL;
    print "Stack trace: {$eol}{$e->getTraceAsString()}" . PHP_EOL;
    exit(1);
}