设置代理转发
wsqun opened this issue · comments
wsqun commented
运行环境
- OS:Linux
- PHP:PHP7
- wechatpay-php:^1.4
描述你的问题现象
微信后台限制了IP白名单配置数量
要如何设置proxy 比如Guzzle可以设置proxy
James ZHANG commented
see https://docs.guzzlephp.org/en/stable/request-options.html#proxy
proxy
Summary
Pass a string to specify an HTTP proxy, or an array to specify different proxies for different protocols.
examples:
全局设置
$instance = Builder::factory([
// 其他必填参数
// 新增代理设置
'proxy' => [
'http' => 'http://localhost:8125', // Use this proxy with "http"
'https' => 'http://localhost:9124', // Use this proxy with "https",
'no' => ['.mit.edu', 'foo.com'] // Don't use a proxy with these
],
]);
每请求设置
$resp = $instance->v3->certificates->get([
// 新增代理设置
'proxy' => [
'http' => 'http://localhost:8125', // Use this proxy with "http"
'https' => 'http://localhost:9124', // Use this proxy with "https",
'no' => ['.mit.edu', 'foo.com'] // Don't use a proxy with these
],
]);
wsqun commented
感谢 可以了