[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/httpful/examples/ -> showclix.php (source)

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


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1