Created
July 15, 2014 10:20
-
-
Save DjangoFR/2a07c6e7749eed4cc90a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
$client = new GuzzleHttp\Client(); | |
//$client->setDefaultOption('auth', array('username', 'password', 'Basic|Digest|NTLM|Any')); | |
$client->setDefaultOption('auth', array('DjangoFR', '********', 'Basic')); | |
$res = $client->get('http://www.example.com/system/get_user_categories/format/json/user_id/**10**'); | |
echo $res->getStatusCode(); | |
// 200 | |
echo $res->getHeader('content-type'); | |
// 'application/json; charset=utf8' | |
echo $res->getBody(); | |
// {"type":"User"...' | |
var_export($res->json()); | |
// Outputs the JSON decoded data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment