对于其他想要实现相同目标的人,我想我会列出一些示例代码:
<!DOCTYPE HTML>
<html>
<head>
<title>Eventbrite</title>
<meta charset="UTF-8">
</head>
<body>
<?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' => 'YOURAPPKEYGOESHERE',
'user_key' => 'YOURUSERKEYGOESHERE');
$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();
$search_params = array(
'organizer' => 'YOURORGANISERNAMEGOESHERE',
'sort_by' => 'date',
);
$resp = $eb_client->event_search( $search_params );
//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: 300px;
width: 300px;
overflow: hidden;
}
.eb_event_list_date{
padding-left: 20px;
}
.eb_event_list_time{
position: absolute;
left: 200px;
}
.eb_event_list_location{
position: absolute;
left: 620px;
}
</style>
<h1>My Event List:</h1>
<?= Eventbrite::eventList( $resp, 'eventListRow'); ?>
</body>
</html>
如果要更改返回数据的方式,请编辑 eventbrite.php 页面。例如,我想在日期中包含年份,所以我编辑了第 258 行,将 strftime 更改为
strftime('%a, %e, %B, %Y', $time)
希望这可以帮助某人:)