1 Star 0 Fork 0

lanyou/HTTP_Request2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

HTTP_Request2

Build Status

Provides an easy way to perform HTTP requests, uses pluggable adapters

  • 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...

This package is PEAR HTTP_Request2 and has been migrated from PEAR SVN

Please report all issues via the GitHub issues.

Pull requests are welcome.

Installation

The package may be installed either with PEAR

$ pear install HTTP_Request2

or with composer

$ 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.

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

Generated API documentation for the current release is also there.

Testing, Packaging and Installing (Pear)

To test, run

$ phpunit tests/

after installing dependencies with composer. You can also test the installed package with

$ 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

$ php pear-package-helper.php

Then to build, simply

$ pear package .pear-package/package.xml

To install from scratch

$ pear install .pear-package/package.xml

To upgrade

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

空文件

简介

取消

发行版

暂无发行版

贡献者 (3)

全部

语言

近期动态

1年多前推送了新的提交到 tags/HTTP_Request2-0.4.1 分支,fd729bc...a750112
1年多前创建了仓库
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/wdoc/HTTP_Request2.git
git@gitee.com:wdoc/HTTP_Request2.git
wdoc
HTTP_Request2
HTTP_Request2
tags/HTTP_Request2-0.4.1

搜索帮助