Skip to content

Instantly share code, notes, and snippets.

@sidchilling
Created November 30, 2012 19:29
Show Gist options
  • Save sidchilling/4177963 to your computer and use it in GitHub Desktop.
Save sidchilling/4177963 to your computer and use it in GitHub Desktop.
HttpRequest for GET
<?php
$request = new HttpRequest($url, HttpRequest::METH_GET); #METH_GET indicates that it is a GET request
$request->addQueryData($data); # $data is the array with the parameters to send
$request->send();
if ($request->getResponseCode() == 200) {
$response = json_decode($request->getResponseBody());
# we have the response from the web-service
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment