Skip to content

Instantly share code, notes, and snippets.

@KamranSyed
Last active April 21, 2018 17:57
Show Gist options
  • Select an option

  • Save KamranSyed/eaafdc44089d7a54a9e61657d94b8a55 to your computer and use it in GitHub Desktop.

Select an option

Save KamranSyed/eaafdc44089d7a54a9e61657d94b8a55 to your computer and use it in GitHub Desktop.
PHP REST Client Learning by Example
<?php
//This gist is part of a video tutorial at https://youtu.be/TSWVm9VO-_U
require_once 'restclient.php';
$url = "https://api.github.com/users/";
$api = new RestClient([
'base_url' => $url,
'format' => "json"
]);
$result = $api->get("kamransyed");
echo "<pre>";
if($result->info->http_code == 200){
print_r($result->decode_response());
}else{
print_r($result);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment