Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Last active December 18, 2015 02:48
Show Gist options
  • Save AbhishekGhosh/5713705 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/5713705 to your computer and use it in GitHub Desktop.
API example
class RestRequest
{
protected $url;
protected $verb;
protected $requestBody;
protected $requestLength;
protected $username;
protected $password;
protected $acceptType;
protected $responseBody;
protected $responseInfo;
public function __construct ($url = null, $verb = 'GET', $requestBody = null)
{
$this->url = $url;
$this->verb = $verb;
$this->requestBody = $requestBody;
$this->requestLength = 0;
$this->username = null;
$this->password = null;
$this->acceptType = 'application/json';
$this->responseBody = null;
$this->responseInfo = null;
if ($this->requestBody !== null)
{
$this->buildPostBody();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment