1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00
phorge-phorge/externals/httpful/examples/showclix.php
epriestley 23786784ef Add Balanced Payments API
Summary: Adds the Balanced PHP API to externals/. Ref T2787.

Test Plan: Used in next diff.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran, aurelijus

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D5764
2013-04-25 09:47:30 -07:00

24 lines
No EOL
773 B
PHP

<?php
require(__DIR__ . '/../bootstrap.php');
use \Httpful\Request;
// Get event details for a public event
$uri = "http://api.showclix.com/Event/8175";
$response = Request::get($uri)
->expectsType('json')
->sendIt();
// 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')
->sendIt();
// Print out the event details
echo "The event {$response->body['event']} will take place on {$response->body['event_start']}\n";