Download the PHP package cdcchen/http-client without Composer
On this page you can find all versions of the php package cdcchen/http-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download cdcchen/http-client
More information about cdcchen/http-client
Files in cdcchen/http-client
Download cdcchen/http-client
More information about cdcchen/http-client
Files in cdcchen/http-client
Vendor cdcchen
Package http-client
Short Description http client
License BSD-4-Clause
Homepage https://github.com/cdcchen/http-client
Package http-client
Short Description http client
License BSD-4-Clause
Homepage https://github.com/cdcchen/http-client
Please rate this library. Is it a good library?
Informations about the package http-client
CURL Http Client
composer 安装
使用教程
第一步:实例化HttpRequest
第二步:发起请求
第三步:获取返回相关数据
返回的$response
类型为HttpResponse
。HttpResponse
会自动根据返回的Content-Type
解析返回的数据。目前支持以下格式:
- HttpRequest::FORMAT_JSON
- HttpRequest::FORMAT_XML
- HttpRequest::FORMAT_URLENCODED
- HttpRequest::FORMAT_RAW_URLENCODED
如果已经明确知道返回数据的格式,也可以显式的指定$response
的format属性:
然后可以直接通过$response->getData()
来获取到解析之后的数据。
获取 Status Code
获取原始 body 数据:
获取返回的 Headers
获取 Cookies
设置超时时间
设置 HttpRequest 请求
设置请求方法
设置请求参数
设置post body
设置Header
Header shortcut
设置Cookies
使用SSL
上传文件
$file 可以为文件路径,也可以为CURLFile实例。
设置发起请求时body的格式化方式
request
会自动根据format的值来格式化data
format
的取值如下:
- HttpRequest::FORMAT_URLENCODED 默认
- HttpRequest::FORMAT_RAW_URLENCODED
- HttpRequest::FORMAT_JSON
- HttpRequest::FORMAT_XML
配置 Curl Options
All versions of http-client with dependencies
PHP Build Version
Package Version
The package cdcchen/http-client contains the following files
Loading the files please wait ....