Last active
December 24, 2015 12:59
Revisions
-
jwcobb renamed this gist
Oct 2, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jwcobb created this gist
Oct 2, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,98 @@ require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Zend_'); $autoloader->registerNamespace('Ticketevolution_'); $autoloader->setFallbackAutoloader(false); $cfg['params']['apiToken'] = (string) 'TOKEN'; $cfg['params']['secretKey'] = (string) 'KEY'; $cfg['params']['apiVersion'] = (string) '9'; $cfg['params']['buyerId'] = 'BUYERID'; $cfg['params']['baseUri'] = (string) 'https://api.ticketevolution.com';; $tevoClient = new \TicketEvolution\Webservice($cfg['params']); $performerSearchName = (string) 'Depeche Mode'; $options = array( 'page' => 1, 'per_page' => 1, ); try { $performers = $tevoClient->searchPerformers($performerSearchName, $options); } catch(\TicketEvolution\ApiInvalidRequestException $e) { // Invalid parameters were supplied // Put something here to gracefully handle this situation } catch (\TicketEvolution\ApiAuthenticationException $e) { // Authentication with the API failed // Put something here to gracefully handle this situation } catch (\TicketEvolution\ApiConnectionException $e) { // Network communication failed // Put something here to gracefully handle this situation } catch (\TicketEvolution\ApiException $e) { // Something went wrong with the request // Put something here to gracefully handle this situation } catch (\Exception $e) { // Something else happened, probably unrelated to TicketEvolution // Put something here to gracefully handle this situation } if (count ($performers) > 0) { $performer_id = $row->id; $optionsEvents = array( 'page' => 1, 'per_page' => 100, 'performer_id' => $performers->current()->id, 'primary_performer' => 'true', ); try { $events = $tevoClient->listEvents($optionsEvents); } catch(\TicketEvolution\ApiInvalidRequestException $e) { // Invalid parameters were supplied // Put something here to gracefully handle this situation } catch (\TicketEvolution\ApiAuthenticationException $e) { // Authentication with the API failed // Put something here to gracefully handle this situation } catch (\TicketEvolution\ApiConnectionException $e) { // Network communication failed // Put something here to gracefully handle this situation } catch (\TicketEvolution\ApiException $e) { // Something went wrong with the request // Put something here to gracefully handle this situation } catch (\Exception $e) { // Something else happened, probably unrelated to TicketEvolution // Put something here to gracefully handle this situation } } if (isset($events) && !empty($events)) { foreach ($events as $event) { $eventDateTime = new \TicketEvolution\DateTime($event->occurs_at); echo '<p>' . $event->name . ' at ' . $event->venue->name . ' at ' . $eventDateTime->formatTbaSafe(\TicketEvolution\DateTime::DATETIME_FULL_NOTZ) . '</p>' . PHP_EOL; } } else { echo '<p>Sorry, there are not currently events for ' . $performerSearchName . '</p>' . PHP_EOL; }