Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DjangoFR/2a07c6e7749eed4cc90a to your computer and use it in GitHub Desktop.
Save DjangoFR/2a07c6e7749eed4cc90a to your computer and use it in GitHub Desktop.
<?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