poirot/http

此包已被弃用且不再维护。作者建议使用poirot/http包。
此包的最新版本(dev-master)没有可用的许可信息。

HTTP 请求和响应。

dev-master 2017-05-10 10:33 UTC

This package is auto-updated.

Last update: 2020-07-05 18:55:28 UTC


README

从构建器构建 Http 请求

构建器支持字符串或数组设置。

$reqStr =<<< DOC
GET /api/v1.1/page/search HTTP/1.1
Host: site.com
Cache-Control: no-cache
DOC;

$request = new \Poirot\Http\HttpRequest(
    new BuildHttpRequest(BuildHttpRequest::parseWith($reqStr))
);

头部

HeaderFactory::of('WWW-Authenticate: Basic realm="admin_panel"');
HeaderFactory::of(['WWW-Authenticate', 'Basic realm="admin_panel"']);
// options of specific header as plugin
HeaderFactory::of('WWW-Authenticate' => ['header_line' => 'Basic realm="admin_panel"']);