File: showclix.php

package info (click to toggle)
php-httpful 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 388 kB
  • sloc: php: 1,677; xml: 20; makefile: 11
file content (24 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

require('Httpful/autoload.php');

use \Httpful\Request;

// Get event details for a public event
$uri = "http://api.showclix.com/Event/8175";
$response = Request::get($uri)
    ->expectsType('json')
    ->send();

// Print out the event details
echo "The event {$response->body->event} will take place on {$response->body->event_start}\n";

// Example overriding the default JSON handler with one that encodes the response as an array
\Httpful\Httpful::register(\Httpful\Mime::JSON, new \Httpful\Handlers\JsonHandler(array('decode_as_array' => true)));

$response = Request::get($uri)
    ->expectsType('json')
    ->send();

// Print out the event details
echo "The event {$response->body['event']} will take place on {$response->body['event_start']}\n";