Skip to content

Instantly share code, notes, and snippets.

@sidchilling
Created November 30, 2012 19:50
Show Gist options
  • Select an option

  • Save sidchilling/4178106 to your computer and use it in GitHub Desktop.

Select an option

Save sidchilling/4178106 to your computer and use it in GitHub Desktop.
GET requests with Requests
<?php
require_once('./requests/library/Requests.php'); # have to require this single file
Requests::register_autoloader(); # needed by Requests class to autoload internal classes
$response = Requests::request($url, array(), $data); # The empty array is for headers if you want to send any
if ($response->success) {
$response = json_decode($response->body);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment