2017 © Pedro Peláez
 

library http_request2

Provides an easy way to perform HTTP requests.

image

pear/http_request2

Provides an easy way to perform HTTP requests.

  • Saturday, February 13, 2016
  • by alex.bumbacea
  • Repository
  • 18 Watchers
  • 34 Stars
  • 943,389 Installations
  • PHP
  • 43 Dependents
  • 1 Suggesters
  • 33 Forks
  • 2 Open issues
  • 6 Versions
  • 8 % Grown

The README.md

HTTP_Request2

Build Status, (*1)

Static Analysis, (*2)

Provides an easy way to perform HTTP requests, uses pluggable adapters, (*3)

  • Socket: pure PHP implementation of HTTP protocol (does not use http stream wrapper), based on older PEAR HTTP_Request package
  • Curl: wrapper around PHP's cURL extension
  • Mock: used for testing packages depending on HTTP_Request2, returns predefined responses without network interaction

Both Socket and Curl adapters support POST requests with data and file uploads, basic and digest authentication, cookies, managing cookies across requests, HTTP and SOCKS5 proxies, gzip and deflate encodings, redirects, monitoring the request progress with Observers..., (*4)

This package is PEAR HTTP_Request2 and has been migrated from PEAR SVN, (*5)

Please report all issues via the GitHub issues., (*6)

Pull requests are welcome., (*7)

Installation

The package may be installed either with PEAR, (*8)

$ pear install HTTP_Request2

or with composer, (*9)

$ composer require pear/http_request2

Since release 2.4 composer installation relies completely on autoloading and does not contain require_once calls or use include-path option., (*10)

Basic usage

require_once 'HTTP/Request2.php'; // Only when installed with PEAR

$request = new HTTP_Request2('http://pear.php.net/', HTTP_Request2::METHOD_GET);
try {
    $response = $request->send();
    if (200 == $response->getStatus()) {
        echo $response->getBody();
    } else {
        echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
             $response->getReasonPhrase();
    }
} catch (HTTP_Request2_Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

Documentation

...is available on PEAR website, (*11)

Generated API documentation for the current release is also there., (*12)

Testing, Packaging and Installing (Pear)

To test, run, (*13)

$ phpunit tests/

after installing dependencies with composer. You can also test the installed package with, (*14)

$ phpunit [PEAR tests dir]/HTTP_Request2

Since PEAR package needs its require_once statements re-enabled, please run the helper file before packaging and installing, (*15)

$ php pear-package-helper.php

Then to build, simply, (*16)

$ pear package .pear-package/package.xml

To install from scratch, (*17)

$ pear install .pear-package/package.xml

To upgrade, (*18)

$ pear upgrade -f .pear-package/package.xml

The Versions

13/02 2016

dev-trunk

9999999-dev http://pear.php.net/package/HTTP_Request2

Provides an easy way to perform HTTP requests.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexey Borzov

curl http request pear

13/02 2016

v2.3.0

2.3.0.0 http://pear.php.net/package/HTTP_Request2

Provides an easy way to perform HTTP requests.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexey Borzov

curl http request pear

20/06 2015

dev-delian-observer

dev-delian-observer http://pear.php.net/package/HTTP_Request2

Provides an easy way to perform HTTP requests.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexey Borzov

curl http request pear

18/02 2014

dev-topics/composer-for-pear

dev-topics/composer-for-pear http://pear.php.net/package/HTTP_Request2

Provides an easy way to perform HTTP requests.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Alexey Borzov

curl http request pear

16/01 2014

v2.2.1

2.2.1.0 http://pear.php.net/package/HTTP_Request2

Provides an easy way to perform HTTP requests.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexey Borzov

curl http request pear

12/01 2014

v2.2.0

2.2.0.0 https://github.com/pear/HTTP_Request2

Provides an easy way to perform HTTP requests.

  Sources   Download

BSD-2-Clause

The Requires

 

by Alexey Borzov

http request