总结:
1.GUZZLE包最终还是用的curl的curl_exec和curl_multi_exec去请求,可以添加自定义配置,这些配置最终还是会对应到 curl_setopt_array($easy->handle, $conf); 设置
2.还有一个就是可以做一些请求前或者请求返回后的中间件。介入请求的过程中处理$stack = new HandlerStack(); push,handler进去
//使用默认配置去构建客户端
$client = new Client();
//设置CURL,使用去构建客户端
$client = new \GuzzleHttp\Client([
'curl' => [
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 1,
]
]);
//代理设置
$proxy = [
//http域名代理
'http' => config('app.fileserver_proxy') . ':' . config('app.fileserver_port'), // Use this proxy with "http"
//https域名代理
'https' => config('app.fileserver_proxy') . ':' . config('app.fileserver_port