Skip to content

Instantly share code, notes, and snippets.

@rorymcdaniel
Created October 13, 2016 17:24
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 rorymcdaniel/ea95000bc68819381352fe824499dd5d to your computer and use it in GitHub Desktop.
Save rorymcdaniel/ea95000bc68819381352fe824499dd5d to your computer and use it in GitHub Desktop.
<?php
$wp = new GuzzleHttp\Client();
$request = $wp->get('http://www.example.com/wp-json/wp/v2/users');
$statusCode = $request->getStatusCode();
if($statusCode >= 200 && $statusCode < 300 ) {
$users = json_decode($request->getBody());
foreach($users as $user) {
//var_dump($user->id);
//var_dump($user->name);
//var_dump($user->slug);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment