Reputation: 39
I am working with this api for Eventbrite https://github.com/ryanjarvinen/eventbrite.php
It pulls the events in ok but when there are know events posted it gives me an error:
Fatal error: Uncaught exception 'Exception' with message 'No events found for this user.' in /home/davidhender/glasgowcitymission.davidhendersondesign.com/news-events/Eventbrite.php:109 Stack trace: #0 /home/davidhender/glasgowcitymission.davidhendersondesign.com/news-events/events/eventbrite.php(17): Eventbrite->__call('user_list_event...', Array) #1 /home/davidhender/glasgowcitymission.davidhendersondesign.com/news-events/events/eventbrite.php(17): Eventbrite->user_list_events() #2 {main} thrown in /home/davidhender/glasgowcitymission.davidhendersondesign.com/news-events/Eventbrite.php on line 109
<?php
// load the API Client library
include "../Eventbrite.php";
// Initialize the API client
// Eventbrite API / Application key (REQUIRED)
// http://www.eventbrite.com/api/key/
// Eventbrite user_key (OPTIONAL, only needed for reading/writing private user data)
// http://www.eventbrite.com/userkeyapi
$authentication_tokens = array('app_key' => 'UHH2XQAMZXTTZM526G',
'user_key' => '139627418395393246769');
$eb_client = new Eventbrite( $authentication_tokens );
// For more information about the features that are available through the Eventbrite API, see http://developer.eventbrite.com/doc/
$events = $eb_client->user_list_events();
//mark-up the list of events that were requested
// render in html - ?>
<style type="text/css">
.eb_event_list_item{
padding-top: 20px;
}
.eb_event_list_title{
position: absolute;
left: 220px;
width: 300px;
overflow: hidden;
}
.eb_event_list_date{
padding-left: 20px;
}
.eb_event_list_time{
position: absolute;
left: 150px;
}
.eb_event_list_location{
position: absolute;
left: 520px;
}
</style>
<h1>My Event List:</h1>
<?= Eventbrite::eventList( $events, 'eventListRow'); ?>
Upvotes: 0
Views: 273
Reputation: 1847
try this
<?php
try {
$events = $eb_client->user_list_events();
} catch ( Exception $e ) {
// Be sure to plan for potential error cases
// so that your application can respond appropriately
$events = array();
}
?>
to echoes the event list
<?= Eventbrite::eventList( $events, 'eventListRow'); ?>
Upvotes: 1