资源说明:HTTP Request and Response tools
Aura HTTP ========= [![Build Status](https://travis-ci.org/auraphp/Aura.Http.png?branch=develop)](https://travis-ci.org/auraphp/Aura.Http) The Aura HTTP package provides objects to build and send HTTP requests and responses, including `multipart/form-data` requests, with streaming of file resources when using the `curl` adapter. This package is compliant with [PSR-0][], [PSR-1][], and [PSR-2][]. If you notice compliance oversights, please send a patch via pull request. [PSR-0]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md [PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md [PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md Getting Started =============== Instantiation ------------- The easiest way to get started is to use the `scripts/instance.php` script to instantiate an HTTP `Manager` object. ```php newResponse(); $response->headers->set('Content-Type', 'text/plain'); $response->setContent('Hello World!'); $http->send($response); // make a request and get a response stack $request = $http->newRequest(); $request->setUrl('http://example.com'); $stack = $http->send($request); echo $stack[0]->content; ``` HTTP Responses ============== Instantiation ------------- Use the `Manager` to create a new HTTP response. ```php newResponse(); ``` Setting And Getting Content --------------------------- To set the content of the `Response`, use `setContent()`. ```php ' . 'Test ' . 'Hello World!' . '