Created
November 30, 2012 19:29
-
-
Save sidchilling/4177963 to your computer and use it in GitHub Desktop.
HttpRequest for GET
This file contains 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 | |
$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