```
~~~
public function cookc()
{
//实例化客户端
$client = new \GuzzleHttp\Client(['cookie'=>true]);
//构造url
$url = 'https://www.taobao.com';
//设置代理请求
$res = $client->request('GET', $url)->getBody()->getContents();
//返回状态码
dump($res);
}
~~~
```
```
~~~
string(111399) "
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<title>淘*网 - 淘!我喜欢</title>
<meta name="spm-id" content="a21bo" />
~~~
```
```
~~~
public function cooka()
{
// $client = new \GuzzleHttp\Client(['cookies' => true]);
$client = new \GuzzleHttp\Client(['base_uri' => 'https://www.tao*ao.com/']);
$jar = new \GuzzleHttp\Cookie\CookieJar;
$r = $client->request('GET', 'https://www.tao*ao.com/', [
'cookies' => $jar
]);
// $r = $client->request('GET', 'https://www.tao*ao.com');
dump($r);
}
~~~
```
```
~~~
object(GuzzleHttp\Psr7\Response)#67 (6) {
["reasonPhrase":"GuzzleHttp\Psr7\Response":private] => string(2) "OK"
["statusCode":"GuzzleHttp\Psr7\Response":private] => int(200)
["headers":"GuzzleHttp\Psr7\Response":private] => array(26) {
["Server"] => array(1) {
[0] => string(7) "Tengine"
}
["Content-Type"] => array(1) {
[0] => string(24) "text/html; charset=utf-8"
}
["Transfer-Encoding"] => array(1) {
[0] => string(7) "chunked"
}
["Connection"] => array(1) {
[0] => string(10) "keep-alive"
}
["Date"] => array(1) {
[0] => string(29) "Sat, 25 Sep 2021 08:22:05 GMT"
}
["Vary"] => array(2) {
[0] => string(15) "Accept-Encoding"
[1] => string(50) "Origin, Ali-Detector-Type, X-Host, Accept-Encoding"
}
["x-server-id"] => array(1) {
[0] => string(80) "28c3d6b2523ca52cb704b8b5dcd97677865cbbd91a3b0c7390a3a6f9f6babccc8bb00e660f25c2b1"
}
["x-air-hostname"] => array(1) {
[0] => string(31) "air-ual011087145003.center.na61"
}
["x-air-trace-id"] => array(1) {
[0] => string(26) "6f07ad0d16325581250005461e"
}
["Cache-Control"] => array(1) {
[0] => string(23) "max-age=0, s-maxage=109"
}
["etag"] => array(1) {
[0] => string(37) "W/"1b212-8CR+cNi3V6+Yp01zdJgFJgctuxg""
}
["x-readtime"] => array(1) {
[0] => string(3) "221"
}
["x-via"] => array(1) {
[0] => string(93) "cn474.l1, cache3.cn474, l2nu16-1.l2, cache21.l2nu16-1, wormholesource011001084075.center.na61"
}
["x-air-source"] => array(1) {
[0] => string(5) "proxy"
}
["x-xss-protection"] => array(1) {
[0] => string(13) "1; mode=block"
}
["EagleEye-TraceId"] => array(1) {
[0] => string(26) "6f07ad0d16325581250005461e"
}
["Strict-Transport-Security"] => array(1) {
[0] => string(16) "max-age=31536000"
}
["Timing-Allow-Origin"] => array(1) {
[0] => string(4) "*, *"
}
["Ali-Swift-Global-Savetime"] => array(1) {
[0] => string(10) "1632558125"
}
["Via"] => array(1) {
[0] => string(106) "cache21.l2nu16-1[294,233,304-0,C], cache14.l2nu16-1[235,0], cache16.cn697[0,0,200-0,H], cache9.cn697[20,0]"
}
["Age"] => array(1) {
[0] => string(1) "3"
}
["X-Cache"] => array(1) {
[0] => string(26) "HIT TCP_MEM_HIT dirn:-2:-2"
}
["X-Swift-SaveTime"] => array(1) {
[0] => string(29) "Sat, 25 Sep 2021 08:22:05 GMT"
}
["X-Swift-CacheTime"] => array(1) {
[0] => string(3) "109"
}
["x-air-pt"] => array(1) {
[0] => string(3) "pt0"
}
["EagleId"] => array(1) {
[0] => string(26) "3da8641d16325581283392727e"
}
}
["headerNames":"GuzzleHttp\Psr7\Response":private] => array(26) {
["server"] => string(6) "Server"
["content-type"] => string(12) "Content-Type"
["transfer-encoding"] => string(17) "Transfer-Encoding"
["connection"] => string(10) "Connection"
["date"] => string(4) "Date"
["vary"] => string(4) "Vary"
["x-server-id"] => string(11) "x-server-id"
["x-air-hostname"] => string(14) "x-air-hostname"
["x-air-trace-id"] => string(14) "x-air-trace-id"
["cache-control"] => string(13) "Cache-Control"
["etag"] => string(4) "etag"
["x-readtime"] => string(10) "x-readtime"
["x-via"] => string(5) "x-via"
["x-air-source"] => string(12) "x-air-source"
["x-xss-protection"] => string(16) "x-xss-protection"
["eagleeye-traceid"] => string(16) "EagleEye-TraceId"
["strict-transport-security"] => string(25) "Strict-Transport-Security"
["timing-allow-origin"] => string(19) "Timing-Allow-Origin"
["ali-swift-global-savetime"] => string(25) "Ali-Swift-Global-Savetime"
["via"] => string(3) "Via"
["age"] => string(3) "Age"
["x-cache"] => string(7) "X-Cache"
["x-swift-savetime"] => string(16) "X-Swift-SaveTime"
["x-swift-cachetime"] => string(17) "X-Swift-CacheTime"
["x-air-pt"] => string(8) "x-air-pt"
["eagleid"] => string(7) "EagleId"
}
["protocol":"GuzzleHttp\Psr7\Response":private] => string(3) "1.1"
["stream":"GuzzleHttp\Psr7\Response":private] => object(GuzzleHttp\Psr7\Stream)#65 (7) {
["stream":"GuzzleHttp\Psr7\Stream":private] => resource(118) of type (stream)
["size":"GuzzleHttp\Psr7\Stream":private] => NULL
["seekable":"GuzzleHttp\Psr7\Stream":private] => bool(true)
["readable":"GuzzleHttp\Psr7\Stream":private] => bool(true)
["writable":"GuzzleHttp\Psr7\Stream":private] => bool(true)
["uri":"GuzzleHttp\Psr7\Stream":private] => string(10) "php://temp"
["customMetadata":"GuzzleHttp\Psr7\Stream":private] => array(0) {
}
}
}
~~~
```
- extend加入模块
- array_column() expects parameter 1 to be array, object given
- tp5.1安装No input file specified.
- ROOT
- wechatDeveloper
- ThinkLibrary
- 语法错误: unexpected '?'
- Cannot use object of type stdClass as array
- Invalid argument supplied for foreach()
- 常量上传
- 命名空间extend_email_Aindex
- Validate
- 'cross-env' 不是内部或外部命令,也不是可运行的程序
- 内置规则
- composer self-update
- cURL error 60: SSL certificate problem
- GuzzleHttp_Client_cookie_true
- cookies原始字符串转换为数组
- 设置cookie
- apidoc
- 原生安装tp5
- array_unique
- explode
- tp3修改密码
- tp打印SQL
- tp5一对一关联
- allowField
- array_column
- array_key_exists
- array_search
- tp5如何引入自定义函数
- with
- with闭包
- 绑定类
- composer A
- array_filter用回调函数过滤数组中的元素
- array_keys
- array_slice截取前两个
- fetch_assoc
- in_array是否存在指定的值
- is_null
- join
- krsort对数组排序
- array-udiff
- shuffle
- substr
- unset删除多维数组key
- 多维转一维函数
- 数组变成字符串implode
- 数组分割
- 数组取差集
- 随机函数array_rand
- 一维变二维
- 字符串包裹变量
- 字符串汉字截取mb_substr
- 直接使用composer命令
- 安装vendor
- composer命令
- 复制安装
- 空目录安装
- tp5cms
- tp5调试
- tp3调试
- TP5一对一关联
- SQL语句
- 清空数据
- 去重
- 去重保留最小id
- 去重匹配除数字外数据
- 事务
- tp5pdf乱码
- tp5column_tp3getFieldtrue
- php代码在线测试,php在线执行
- parent::_initialize