showclix.php 769 B

123456789101112131415161718192021222324
  1. <?php
  2. require(__DIR__ . '/../bootstrap.php');
  3. use \Httpful\Request;
  4. // Get event details for a public event
  5. $uri = "http://api.showclix.com/Event/8175";
  6. $response = Request::get($uri)
  7. ->expectsType('json')
  8. ->send();
  9. // Print out the event details
  10. echo "The event {$response->body->event} will take place on {$response->body->event_start}\n";
  11. // Example overriding the default JSON handler with one that encodes the response as an array
  12. \Httpful\Httpful::register(\Httpful\Mime::JSON, new \Httpful\Handlers\JsonHandler(array('decode_as_array' => true)));
  13. $response = Request::get($uri)
  14. ->expectsType('json')
  15. ->send();
  16. // Print out the event details
  17. echo "The event {$response->body['event']} will take place on {$response->body['event_start']}\n";