Last active
April 21, 2018 17:57
-
-
Save KamranSyed/eaafdc44089d7a54a9e61657d94b8a55 to your computer and use it in GitHub Desktop.
PHP REST Client Learning by Example
This file contains hidden or 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 | |
| //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