proxy
摘要
传入字符串来指定HTTP代理,或者为不同代理指定不同协议的数组。
类型
- string
- array
默认值
None
常量
GuzzleHttp\RequestOptions::PROXY
传入字符串为所有协议指定一个代理:
1. $client->request('GET', '/', ['proxy' => 'tcp://localhost:8125']);
传入关联数组来为特殊的URI Scheme指定特色的HTTP代理(比如”http”, “https”) 提供一个 no 键值对来提供一组不需要使用代理的主机名。
1. $client->request('GET', '/', [
2. 'proxy' => [
3. 'http' => 'tcp://localhost:8125', // Use this proxy with "http"
4. 'https' => 'tcp://localhost:9124', // Use this proxy with "https",
5. 'no' => ['.mit.edu', 'foo.com'] // Don't use a proxy with these
6. ]
7. ]);
