gatorv/simple-http

There is no license information available for the latest version (dev-master) of this package.

Simple wrapper for cURL for basic requests

dev-master 2017-08-18 07:10 UTC

This package is not auto-updated.

Last update: 2024-05-26 00:46:18 UTC


README

Simple PHP Http Request Wrapper using cURL under the hood.

Installation

$ php composer.phar require gatorv/simple-http

Usage

Basic Usage

use Gatorv\Web\SimpleHttpRequest as Request;

$req = new Request();
list($headers, $body) = $req->get('https://url/');

Main Methods

Perform a GET Request

$req->get($url); 

Perform a POST Request:

$req->post($url, $data); 

Methods

The following options can be customized on constructing the object (or after construction:

  1. redirects - The number of redirects to perform if a Location header is sent.
  2. proxy - The proxy and port to use
  3. 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();