Closed BInodes-official closed 4 years ago
Hello @zhoufann9188 !
Thanks for the interest in this plugin! Please let me first elaborate on what this option does. When the option is checked, and the proxy AND the port are specified, the options CURLOPT_PROXY
and CURLOPT_PROXYPORT
for the cUrl request sent to the WeChat API are set like below (extract of wechat-sdk.php
):
if ($this->proxy && !empty($this->proxyHost) && !empty($this->proxyPort)) {
$opts[CURLOPT_PROXY] = $this->proxy;
$opts[CURLOPT_PROXYPORT] = $this->proxyPort;
}
$ch = curl_init();
curl_setopt_array($ch, $opts);
$data = curl_exec($ch);
$err = curl_errno($ch);
$errmsg = curl_error($ch);
curl_close($ch);
With that being said, what were your expectations? Could you please elaborate on your use case, and maybe provide suggestions, perhaps as code snippets to improve the plugin and put me in the right direction?
Hello My dear French Manager!
Thanks for your replay . You developed a good plugins WP-weixin; i tested it and use it these days, others function is great,only this problem I founded:
My Web ENV is this:
I just use the image for my ENV, I think it's more intuitive;
I would appreciate your help in solving this problem,thank you!!
262795838@qq.com
From: Alexandre Froger Date: 2020-02-26 21:40 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Hello @zhoufann9188 ! Thanks for the interest in this plugin! Please let me first elaborate on what this option does. When the option is checked, and the proxy AND the port are specified, the options CURLOPT_PROXY and CURLOPT_PROXYPORT for the cUrl request sent to the WeChat API are set like below (extract of wechat-sdk.php): if ($this->proxy && !empty($this->proxyHost) && !empty($this->proxyPort)) { $opts[CURLOPT_PROXY] = $this->proxy; $opts[CURLOPT_PROXYPORT] = $this->proxyPort; } $ch = curl_init();
curl_setopt_array($ch, $opts);
$data = curl_exec($ch);
$err = curl_errno($ch);
$errmsg = curl_error($ch);
curl_close($ch);
With that being said, what were your expectations? Could you please elaborate on your use case, and maybe provide suggestions, perhaps as code snippets to improve the plugin and put me in the right direction? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I had a quick look at tinyproxy documentation.
Is the DisableViaHeader
directive uncommented and set to Yes
in your tinyproxy.conf
file?
If it is the case already, I also noticed reading from https://tinyproxy.github.io/ that tinyproxy is a transparent proxy - and it may be that WeChat needs to consider the connection as a direct one. There is no real way for me to tell what headers WeChat is using for its IP whitelist check, so it might very well be that the level of anonymity you're getting with tinyproxy is not high enough. There are other proxy servers out there like Squid that may be more suitable for your situation as it provides higher anonymity, but I cannot guarantee it.
In the event the option is still not useful for your situation after tweaking the proxy settings, then I'm not sure how to help more.
I'll leave the option there though, as it can still be useful if, for whatever reason, the WordPress installation's outbound connections cannot reach WeChat and would need to be rerouted ("A proxy may be needed if Wordpress is behind a firewall or within a company network."
).
Thanks!
The tinyproxy's "DisableViaHeader " is commented, i have checked again.....
MayBe I can't use the proxy software to weixin API Gateway......
The other plugin "Wenprise WeChatPay Payment Gateway For WooCommerce", It can weinxin pay correctly, But it can't login weixin automatly...... (I am sorry for refer another plugins, i think maybe you can upgrade your great plugin througth this plugin....)
now,I am using "wp-wexin" plugin for loging weinxin, "Wenprise WeChatPay Payment Gateway For WooCommerce" plugin for weinxin pay templately(If i can use wp-weixin for paying please tell me ) .
Now i need the Function refering for weinxin loging in "wp-weinxin" plugin that "Wenprise WeChatPay Payment Gateway For WooCommerce" plugin can refer or use....
Maybe is not the function " wp_weixin_get_user_wechat_openid()", I guess(been try it)
I don't know how to config this code in image below:
Can your help me ? thank you
262795838@qq.com
From: Alexandre Froger Date: 2020-02-26 23:58 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) I had a quick look at tinyproxy documentation. Is the DisableViaHeader directive uncommented and set to Yes in your tinyproxy.conf file? If it is the case already, I also noticed reading from https://tinyproxy.github.io/ that tinyproxy is a transparent proxy - and it may be that WeChat needs to consider the connection as a direct one. There is no real way for me to tell what headers WeChat is using for its IP whitelist check, so it might very well be that the level of anonymity you're getting with tinyproxy is not high enough. There are other proxy servers out there like Squid that may be more suitable for your situation as it provides higher anonymity, but I cannot guarantee it. In the event the option is still not useful for your situation after tweaking the proxy settings, then I'm not sure how to help more. I'll leave the option there though, as it can still be useful if, for whatever reason, the WordPress installation's outbound connections cannot reach WeChat and would need to be rerouted ("A proxy may be needed if Wordpress is behind a firewall or within a company network."). — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Maybe you can use Payment gateway for WooCommerce – Woo WeChatPay (this way no need to code, it's already integrated), but if you really want to use the aforementioned Wenprise plugin, the WP Weixin function to use in their hook is indeed wp_weixin_get_user_wechat_openid
; it takes the ID
field of a WP_User
object as parameter, or uses the current user's ID if not provided see the documentation for reference.
add_filter( 'wprs_wc_wechat_open_id', 'my_plugin_or_theme_wprs_wc_wechat_open_id', 10, 0 );
function my_plugin_or_theme_wprs_wc_wechat_open_id() {
$user_id = get_current_user_id(); // same as if we passed nothing to wp_weixin_get_user_wechat_openid - can also be set with anything you want if it was saved somewhere, such as in a plugin/theme object attribute
$open_id = wp_weixin_get_user_wechat_openid( $user_id );
return $open_id;
}
I just tested adding echo wp_weixin_get_user_wechat_openid();
at the top of the page in my main template and it output the openID properly in WeChat browser ; if adding the wprs_wc_wechat_open_id
does not work, are you sure the filter is fired?
The two plugins are used in combination (wp-weixin and Wenprise). WeChat official account is normal. When the WeChat payment box pops up, two "undefined" boxes will be popped up. Although it can be paid correctly, two rounds will affect the user experience every time. I don't know which plug-in problem is.
If i have choice, I really hope that the payment gateway for woocommerce – woo wechatpay plugin will do. Unfortunately, my agent's proxy is not easy to use, and I don't know where the problem is.I am crazy.... Thank you
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 01:39 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Maybe you can use Payment gateway for WooCommerce – Woo WeChatPay (this way no need to code, it's already integrated), but if you really want to use the aforementioned Wenprise plugin, the WP Weixin function to use in their hook is indeed wp_weixin_get_user_wechat_openid ; it takes the ID field of a WP_User object as parameter, or uses the current user's ID if not provided see the documentation for reference. add_filter( 'wprs_wc_wechat_open_id', 'my_plugin_or_theme_wprs_wc_wechat_open_id', 10, 0 );
function my_plugin_or_theme_wprs_wc_wechat_open_id() { $user_id = get_current_user_id(); // same as if we passed nothing to wp_weixin_get_user_wechat_openid - can also be set with anything you want if it was saved somewhere, such as in a plugin/theme object attribute $open_id = wp_weixin_get_user_wechat_openid( $user_id );
return $open_id; } I just tested adding echo wp_weixin_get_user_wechat_openid(); at the top of the page in my main template and it output the openID properly in WeChat browser ; if adding the wprs_wc_wechat_open_id does not work — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
In that case, I would really recommend you to set up your test environment on an actual server rather than a local machine. This is the method that allowed me to develop the plugin in the first place, because WeChat does not offer any proper sandbox 😡
I went in and changed that password - you are exposing critical merchant information by sharing it on github, please do not do that 🤦🤦🤦
Could you please let me know where you added the filter code?
I remember , in the “插件”--“插件编辑器”-- That plugin only have one php files.
And the wechat pay is not working after i add the filter code , so i remove the filter code.
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 02:05 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) In that case, I would really recommend you to set up your test environment on an actual server rather than a local machine. This is the method that allowed me to develop the plugin in the first place, because WeChat does not offer any proper sandbox — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
In order to avoid possible plug-in conflicts, I seem to have tried to uninstall the WP Wein plug-in
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 02:25 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Could you please let me know where you added the filter code? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
How does "wenprise" plug-in generate PC payment QR code without tinyproxy software? Can you help me see how he did it (I don't know PHP), thank you very much!
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 02:25 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Could you please let me know where you added the filter code? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I cannot really tell where your specific issue comes from.
If the filter code was removed, the the "undefined" alert does not come from WP Weixin... Wenprise and WP Weixin should work side-by-side without interfering with each other because no data is shared between the two of them.
As for now, I will see later about the Wenprise code. I am going to close this issue because the conversation has drifted off topic for quite a while already and it's late (not that it wasn't a pleasure though 😝).
so well,you are very good man,hope you and your plugins better and better,thanks a again!
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 02:45 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Closed #14. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Quick follow up: I installed the Wenprise plugin, configured it, and added the wprs_wc_wechat_open_id
filter in the functions.php
file of my theme as per guidance above.
Wenprise WechatPay payment gateway got called without issue, without any "undefined" window. I would suggest to ask the Wenprise developers in what cases this modal gets displayed, as it seems like poor error handling on their part.
So, as far as I am concerned, WP Weixin is fully compatible with third-party WeChat payment gateways as long as they provide a way to alter the WeChat openID with filters.
The problem still exists. When I add the code in theme's funciont.php , I have to think of another way to try. Thank you
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 11:06 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Quick follow up: I installed the Wenprise plugin, configured it, and added the wprs_wc_wechat_open_id filter in the functions.php file of my theme as per guidance above. Wenprise WechatPay payment gateway got called without issue, without any "undefined" window. I would suggest to ask the Wenprise developers in what cases this modal gets displayed, as it seems like poor error handling on their part. So, as far as I am concerned, WP Weixin is fully compatible with third-party WeChat payment gateways as long as they provide a way to alter the WeChat openID with filters. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
I really want to use your plugins for wechat pay not only logging. because I tested it is profect before. i donlt know why is not OK with tinyproxy. I will test it with Squid later------------------ 原始邮件 ------------------ 发件人: "Alexandre Froger"notifications@github.com 发送时间: 2020年2月27日(星期四) 中午11:06 收件人: "froger-me/wp-weixin"wp-weixin@noreply.github.com; 抄送: "zhoufann9188"262795838@qq.com;"Mention"mention@noreply.github.com; 主题: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14)
Quick follow up: I installed the Wenprise plugin, configured it, and added the wprs_wc_wechat_open_id filter in the functions.php file of my theme as per guidance above.
Wenprise WechatPay payment gateway got called without issue, without any "undefined" window. I would suggest to ask the Wenprise developers in what cases this modal gets displayed, as it seems like poor error handling on their part.
So, as far as I am concerned, WP Weixin is fully compatible with third-party WeChat payment gateways as long as they provide a way to alter the WeChat openID with filters.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
hello!
I used the test script to request(with proxy) wechat API in Python,it can get the "access_token" successed.
and then I confing the https proxy in "WOO"plugin:
It's not ok.....
Could your tell me how to config the "HTTPS" proxy in 'WOO" plugins? Thanks
262795838@qq.com
From: Alexandre Froger Date: 2020-02-27 11:06 To: froger-me/wp-weixin CC: zhoufann9188; Mention Subject: Re: [froger-me/wp-weixin] The Proxy is unuseful (#14) Quick follow up: I installed the Wenprise plugin, configured it, and added the wprs_wc_wechat_open_id filter in the functions.php file of my theme as per guidance above. Wenprise WechatPay payment gateway got called without issue, without any "undefined" window. I would suggest to ask the Wenprise developers in what cases this modal gets displayed, as it seems like poor error handling on their part. So, as far as I am concerned, WP Weixin is fully compatible with third-party WeChat payment gateways as long as they provide a way to alter the WeChat openID with filters. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Could you paste the python code here? What I am looking for is the parameters used for the curl call.
Please delete your answers 😨it contains sensitive data! These answers are public!
Cloud you give me a wechat number or email for communciate directly.. I send code to you. thank you! my wechat "zhoufann9188" email 262795838@qq.com
Thanks to the extra information provided, a critical bug has been found and fixed in v1.3.10. Closing.
It's unuseful after I set the proxy with tinyproxy. So sad