-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
29 lines (18 loc) · 1.16 KB
/
example.php
File metadata and controls
29 lines (18 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
require __DIR__ . '/vendor/autoload.php';
$url = 'http://www.bri6.cn';
$response = network\http\get($url, ['name' => '易航'], ['User-Agent' => 'Mozilla/5.0', 'Accept' => '*'], ['timeout' => 30]);
$response = network\http\post($url, ['name' => '易航'], ['User-Agent' => 'Mozilla/5.0', 'Accept' => '*'], ['timeout' => 30]);
$response = (new network\http\Client(['timeout' => 30]))->header(['User-Agent' => 'Mozilla/5.0', 'Accept' => '*'])->header('Accept-Language', 'zh-CN,zh;q=0.9')->param('name', '易航')->param(['qq' => '2136118039', 'email' => 'xh118039@qq.com'])->get($url);
$response = (new network\http\Client(['timeout' => 30]))->header(['User-Agent' => 'Mozilla/5.0', 'Accept' => '*'])->header('Accept-Language', 'zh-CN,zh;q=0.9')->param('name', '易航')->param(['qq' => '2136118039', 'email' => 'xh118039@qq.com'])->post($url);
// 打印响应状态码
echo $response->code();
// 打印指定响应头
echo $response->header('Content-Type');
// 以数组形式打印所有响应头
print_r($response->headers());
// 如果响应是JSON,获取JSON对象
$data = $response->toObject();
$data = $response->toArray();
// 直接输出响应体
echo $response;