saxulum / saxulum-http-client-adapter-joomla
此包已被弃用且不再维护。未建议替代包。
Saxulum Http Client Adapter Joomla
1.0.5
2014-11-04 08:01 UTC
Requires
- php: >=5.3
- joomla/http: ~1.1,>=1.1.4
- saxulum/saxulum-http-client-interface: ~1.5
Requires (Dev)
- phpunit/phpunit: ~4.0
Provides
This package is not auto-updated.
Last update: 2020-09-22 19:10:04 UTC
README
特性
- 提供joomla的http客户端接口适配器
要求
- PHP 5.3+
- Joomla Http ~1.1
安装
通过Composer以saxulum/saxulum-http-client-adapter-joomla的方式安装。
使用方法
use Saxulum\HttpClient\Joomla\HttpClient;
use Saxulum\HttpClient\Request;
$httpClient = new HttpClient();
$response = $httpClient->request(new Request(
'1.1',
Request::METHOD_GET,
'http://en.wikipedia.org',
array(
'Connection' => 'close',
)
));
在创建http客户端实例时,您可以注入自己的joomla http实例。
use Joomla\Http\Http;
use Joomla\Http\Transport\Stream as StreamTransport;
use Saxulum\HttpClient\Joomla\HttpClient;
$options = array();
$transport = new StreamTransport($options);
$http = new Http($options, $transport);
$httpClient = new HttpClient($http);
重要:响应协议版本是假的,基于请求的版本。因为此http客户端不支持设置em。