foreach ($fields as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // delivers html without auto echo $result = curl_exec($ch); curl_close($ch); // close connection $obj = json_decode($result); $access_token = $obj->{'access_token'}; echo "access: {$access_token} -- eb id: {$eventbrite_id}"; $eb_client = new Eventbrite(array('access_token' => $access_token)); $resp = $eb_client->event_get(array('id' => $eventbrite_id)); echo "ok: {$resp}"; } ?> </div> <script> //App custom javascript </script> </body> </html>
<?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' => 'YOUR_APP_KEY', 'user_key' => 'YOUR_USER_KEY'); $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/ // event_get example - http://developer.eventbrite.com/doc/events/event_get/ $resp = $eb_client->event_get(array('id' => '1848891083')); print Eventbrite::ticketWidget($resp->event); // event_search example - http://developer.eventbrite.com/doc/events/event_search/ $search_params = array('max' => 2, 'city' => 'San Francisco', 'region' => 'CA', 'country' => 'US'); $resp = $eb_client->event_search($search_params); // user_list_events example $user_resp = $eb_client->user_list_events(); //mark-up the list of events that were requested // render in html - ?> <h1>Search Results:</h1> <?php echo Eventbrite::eventList($resp, 'eventListRow'); ?> <br/> <hr/> <br/>