Skip to content

Instantly share code, notes, and snippets.

@sidchilling
Created November 30, 2012 19:42
Show Gist options
  • Save sidchilling/4178045 to your computer and use it in GitHub Desktop.
Save sidchilling/4178045 to your computer and use it in GitHub Desktop.
HttpRequest for POST
<?php
$request = new HttpRequest($url, HttpRequest::METH_POST); # METH_POST indicates a POST request
$request->addPostFields($data); # use this method to add data to the POST request
$request->send();
if ($request->getResponseCode() == 200) {
$response = json_decode($request->getResponseBody());
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment