duandi8544 2014-05-22 13:30
浏览 48
已采纳

Eventbrite.php错误

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'); ?>
  • 写回答

1条回答 默认 最新

  • dsgwoh7038 2014-05-22 14:01
    关注

    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'); ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数