https://github.com/auraphp/aura.http
HTTP Request and Response tools
https://github.com/auraphp/aura.http
aura php request response
Last synced: 9 months ago
JSON representation
HTTP Request and Response tools
- Host: GitHub
- URL: https://github.com/auraphp/aura.http
- Owner: auraphp
- License: bsd-2-clause
- Created: 2011-03-21T14:22:29.000Z (about 15 years ago)
- Default Branch: 1.x
- Last Pushed: 2017-02-24T20:47:42.000Z (about 9 years ago)
- Last Synced: 2025-07-20T16:28:07.887Z (10 months ago)
- Topics: aura, php, request, response
- Language: PHP
- Homepage:
- Size: 577 KB
- Stars: 71
- Watchers: 12
- Forks: 21
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Aura HTTP
=========
[](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!'
. '