Skip to content

Instantly share code, notes, and snippets.

@mosampaio
Last active August 24, 2016 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosampaio/f4b53e4bc8d46f8f27e53b5f91c28cfa to your computer and use it in GitHub Desktop.
Save mosampaio/f4b53e4bc8d46f8f27e53b5f91c28cfa to your computer and use it in GitHub Desktop.
How to consume a json Rest API with PHP using Httpful
<?php
require __DIR__ . '/vendor/autoload.php';
$url = "https://api.github.com/repos/twilio/twilio-php/contributors";
$response = \Httpful\Request::get($url)->expectsJson()->send();
print_r($response->body);
{
"require": {
"nategood/httpful": "0.2.20"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment