wechatpay-apiv3 / wechatpay-php

微信支付 APIv3 的官方 PHP Library,同时也支持 APIv2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

设置代理转发

wsqun opened this issue · comments

commented

运行环境

- OS:Linux
- PHP:PHP7
- wechatpay-php:^1.4

描述你的问题现象

微信后台限制了IP白名单配置数量
要如何设置proxy 比如Guzzle可以设置proxy

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
    ],
]);
commented

感谢 可以了