$url
$url : string
需要请求的Url地址
$handler : \Yurun\Util\YurunHttp\Handler\IHandler
处理器
getHandler() : \Yurun\Util\YurunHttp\Handler\IHandler
获取处理器
buildRequest(string $url = null, array $requestBody = null, string|null $method = null, string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Request
构建请求类
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string|null | $method | 请求方法,GET、POST等 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
send(string $url = null, array $requestBody = null, string|null $method = null, string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Response
发送请求,所有请求的老祖宗
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string|null | $method | 请求方法,GET、POST等 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
sendHttp2WithoutRecv(string $url = null, array $requestBody = null, array $method = 'GET', string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Response
发送 Http2 请求不调用 recv()
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
array | $method | 请求方法,GET、POST等 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
get(string $url = null, array $requestBody = null) : \Yurun\Util\YurunHttp\Http\Response
GET请求
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
post(string $url = null, array $requestBody = null, string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Response
POST请求
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
head(string $url = null, array $requestBody = null) : \Yurun\Util\YurunHttp\Http\Response
HEAD请求
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
put(string $url = null, array $requestBody = null, string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Response
PUT请求
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
patch(string $url = null, array $requestBody = null, string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Response
PATCH请求
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
delete(string $url = null, array $requestBody = null, string|null $contentType = null) : \Yurun\Util\YurunHttp\Http\Response
DELETE请求
string | $url | 请求地址,如果为null则取url属性值 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string|null | $contentType | 内容类型,支持null/json,为null时不处理 |
download(string $fileName, string $url = null, array $requestBody = null, string $method = 'GET') : \Yurun\Util\YurunHttp\Http\Response
直接下载文件
string | $fileName | 保存路径,如果以 .* 结尾,则根据 Content-Type 自动决定扩展名 |
string | $url | 下载文件地址 |
array | $requestBody | 发送内容,可以是字符串、数组,如果为空则取content属性值 |
string | $method | 请求方法,GET、POST等,一般用GET |
websocket(string $url = null) : \Yurun\Util\YurunHttp\WebSocket\IWebSocketClient
WebSocket
string | $url |