Simple PHP Http Request Wrapper using cURL under the hood.
$ php composer.phar require gatorv/simple-http
Basic Usage
use Gatorv\Web\SimpleHttpRequest as Request;
$req = new Request();
list($headers, $body) = $req->get('https://url/');
Perform a GET Request
$req->get($url);
Perform a POST Request:
$req->post($url, $data);
The following options can be customized on constructing the object (or after construction:
- redirects - The number of redirects to perform if a Location header is sent.
- proxy - The proxy and port to use
- ssl - Wether to verify the SSL certificate or not (for testing)
Also the following methods are available:
Use a Desktop User-Agent:
$req->useDesktopAgent();
Use a Mobile User-Agent:
$req->useMobileAgent();
Reset Headers:
$req->resetHeaders();
Request Compression:
$req->requestCompression();
Add a HTTP Cookie:
$req->addCookie();