selvinortiz / hello
PHP CURL 的友好替代品。
dev-master
2013-08-23 18:35 UTC
Requires
- php: >=5.3.2
- selvinortiz/zit: dev-master
This package is auto-updated.
Last update: 2024-09-21 19:50:21 UTC
README
PHP CURL 的友好替代品 by Selvin Ortiz
描述
这个迷你库允许您使用套接字执行无太多繁琐的 GET
和 POST
请求。
要求
- PHP 5.3
- Composer 和 selvinortiz/hello
用法
require '/path/to/vendor/autoload.php'; use selvinortiz\Http\Hello\Hello; $url = 'http://rest.akismet.com/1.1/verify-key'; $data = array( 'blog' => 'http://domain.com', 'key'=>'' ); $headers = array( 'user-agent' => 'Kismet 1.0 selvinortiz/kismet' ); $response = Hello::post( $url, $data, $headers ); echo $response; // Outputs the response content (invalid) print_r($response); // Outputs the response object /* selvinortiz\Http\Hello\HttpResponse Object ( [raw] => Array ( [wrapper_data] => Array ( [0] => HTTP/1.1 200 OK [1] => Server: nginx [2] => Date: Tue, 30 Jul 2013 20:33:40 GMT [3] => Content-Type: text/plain; charset=utf-8 [4] => Content-Length: 7 [5] => Connection: close [6] => X-akismet-server: 192.168.7.151 [7] => X-akismet-debug-help: Empty "key" value ) [wrapper_type] => http [stream_type] => tcp_socket/ssl [mode] => r [unread_bytes] => 0 [seekable] => [uri] => http://rest.akismet.com/1.1/verify-key [timed_out] => [blocked] => 1 [eof] => 1 ) [info] => Array ( [0] => HTTP/1.1 200 OK [1] => Server: nginx [2] => Date: Tue, 30 Jul 2013 20:33:40 GMT [3] => Content-Type: text/plain; charset=utf-8 [4] => Content-Length: 7 [5] => Connection: close [6] => X-akismet-server: 192.168.7.151 [7] => X-akismet-debug-help: Empty "key" value ) [status] => selvinortiz\Http\Hello\HttpStatus Object ( [version] => HTTP/1.1 [code] => 200 [message] => OK ) [response] => invalid ) */
更新日志
v0.3.0
- 修复
/etc/
中的示例 - 使用 composer 包信息更新此说明文件
- 更改所有方法的参数顺序,将
headers
移至最后
v0.2.0
- 为供应商命名空间添加正确的大小写
selvinortiz > SelvinOrtiz
- 添加
PHPUnit
和Travis CI
- 添加简单测试用例
v0.1.0 (alpha)
- 首次发布实现
Hello::get()
和Hello::post()