Author Topic: wp_remote_post() failed  (Read 398 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
wp_remote_post() failed
« on: March 12, 2025, 04:05:13 PM »
Hello everyone,
on my new server I installed the Centos 9 Stream operating system (my provider Hetzner only allows Centos 9 or Alma Linux 9). After installing CWP for Centos 9 I proceed to do some usage tests by installing a test website with woocommerce. From here I notice that I cannot use payment systems because in woocommerce status I have the error wp_remote_post() failed .
On my previous server with Centos 7 I do not have this problem.
CWP support tells me that everything is fine and there is no incompatibility between installed PHP and to contact woocommerce support. Woocommerce tells me that it could be a server problem, giving me some commands to disable selinux, modsecurity (already disabled), and test curl.
Unfortunately the problem persists... I also contacted the owner of the server, Hetzner, and he assured me that there are no active firewalls on their part.
Can anyone help me? I don't know who to trust anymore.
A thousand thanks

Offline
***
Re: wp_remote_post() failed
« Reply #1 on: March 12, 2025, 04:53:25 PM »
Hi,

The function name wp_remote_post() allows me think the function sends some post request to some host. To investigate the problem you need to know where the function wp_remote_post() sends the request to (host) and then emulate the request using "curl" or similar utility, make attempt to connect to the host using "telnet", etc.

Anyway, the problem could be caused by bad DNS resolvers, firewall, error in your script, etc.

Offline
*****
Re: wp_remote_post() failed
« Reply #2 on: March 12, 2025, 05:19:12 PM »
Before you get too far, CentOS Stream is a beta-quality OS, only good for local testing or to get a sense of where RHEL is going but not a good foundation for a server. If you can before you get too far with setup, switch now to AlmaLinux 9 -- it will be supported till the end of the decade!
https://endoflife.date/almalinux

Offline
*
Re: wp_remote_post() failed
« Reply #3 on: March 13, 2025, 10:13:22 AM »

Hi,

The function name wp_remote_post() allows me think the function sends some post request to some host. To investigate the problem you need to know where the function wp_remote_post() sends the request to (host) and then emulate the request using "curl" or similar utility, make attempt to connect to the host using "telnet", etc.

Anyway, the problem could be caused by bad DNS resolvers, firewall, error in your script, etc.

hi,
i'm not very expert in this thing, can you explain to me how to do it?
I can only tell you that I disabled firewall and selinux. I also did a test told by woocommerce support of curl that failed. Here it is:
URL
[2] https://www.paypal.com/cgi-bin/webscr
 Richiesta
Code: [Select]
{
  "metodo": "POST",
  "timeout": 10,
  "redirection": 5,
  "httpversion": "1.1",
  "user-agent": "WooCommerce/9.7.1; [url]https://testsimulazione.it[/url] ",
  "reject_unsafe_urls": true,
  "blocking": true,
  "headers": [],
  "cookies": [],
  "body": {
    "cmd": "_notify-validate"
  },
  "compress": false,
  "decompress": true,
  "sslverify": true,
  "sslcertificates": "/home/simula/public_html/wp-includes/certificates/ca-bundle.crt",
  "stream": false,
  "filename": null,
  "limit_response_size": null,
  "_redirection": 5
}[/codice]

Risposta
[codice]{
  "errors": {
    "http_request_failed": [
      "cURL error 28: Operation timed out after 10000 milliseconds with 0 bytes received"
    ]
  },
  "error_data": []
}

He advised me to check if the PHP modules (curl, mbstring, openssl) are installed (and from the PHP-FPM 8.2 modules they are enabled) and increase the PHP execution time from 300 to 1200 (done).
Hetzner also assured me that the server is not covered by any Firewall. However, I discovered among other forms that the problem could also depend on "remote Send" and "remote get" that are not enabled (but I don't know where to enable them in that case).
« Last Edit: March 13, 2025, 10:16:31 AM by phpprogrammer93 »

Offline
*
Re: wp_remote_post() failed
« Reply #4 on: March 13, 2025, 10:18:01 AM »
Before you get too far, CentOS Stream is a beta-quality OS, only good for local testing or to get a sense of where RHEL is going but not a good foundation for a server. If you can before you get too far with setup, switch now to AlmaLinux 9 -- it will be supported till the end of the decade!
https://endoflife.date/almalinux
hello,
thanks for the advice. Except that I have already tried Almalinux and I have the same problem... That's why I tried Centos 9 Stream.

Offline
*****
Re: wp_remote_post() failed
« Reply #5 on: March 13, 2025, 10:51:19 AM »
The advice is general, not specific to this problem. If you start with a good foundation (AL9), we can help you along the way with specific problems. Otherwise, as a beta-quality OS, CentOS Stream is not really supportable.

Offline
***
Re: wp_remote_post() failed
« Reply #6 on: March 13, 2025, 12:48:44 PM »
Disable firewall and then in shell run:

Code: [Select]
telnet www.paypal.com 443

traceroute  www.paypal.com

iptables -L -n

show us results and run firewall on your vps/server again.

Offline
*
Re: wp_remote_post() failed
« Reply #7 on: March 13, 2025, 02:02:43 PM »
Disable firewall and then in shell run:

Code: [Select]
telnet www.paypal.com 443

traceroute  www.paypal.com

iptables -L -n
show us results and run firewall on your vps/server again.

Hi,
here the results:
Code: [Select]
[root@srv ~]# telnet www.paypal.com 443
-bash: telnet: command not found
[root@srv ~]# traceroute  www.paypal.com
-bash: traceroute: command not found
[root@srv ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
[root@srv ~]# telnet www.paypal.com 443
-bash: telnet: command not found
[root@srv ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
I think there is something wrong with sending commands.

Offline
***
Re: wp_remote_post() failed
« Reply #8 on: March 13, 2025, 05:09:28 PM »
Ok, install traceroute and telnet using dnf:

Code: [Select]
dnf -y install telnet traceroute
the run the commands from the previous post again.

Offline
*
Re: wp_remote_post() failed
« Reply #9 on: March 13, 2025, 06:16:14 PM »
Ok, install traceroute and telnet using dnf:

Code: [Select]
dnf -y install telnet traceroute
the run the commands from the previous post again.
Here the results:
Code: [Select]
[root@srv ~]# telnet www.paypal.com 443
Trying 146.75.121.21...
Connected to www.paypal.com.
Escape character is '^]'.
Connection closed by foreign host.

Code: [Select]
[root@srv ~]# traceroute  www.paypal.com
traceroute to www.paypal.com (146.75.121.21), 30 hops max, 60 byte packets
 1  static.1.48.4.46.clients.your-server.de (46.4.48.1)  0.271 ms  0.311 ms  0.349 ms
 2  core23.fsn1.hetzner.com (213.239.229.121)  0.299 ms  0.281 ms core24.fsn1.hetzner.com (213.239.229.125)  0.369 ms
 3  core4.fra.hetzner.com (213.239.224.114)  4.817 ms core4.fra.hetzner.com (213.239.224.106)  4.842 ms  4.835 ms
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

Code: [Select]
[root@srv ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Offline
***
Re: wp_remote_post() failed
« Reply #10 on: March 13, 2025, 10:08:07 PM »
You server can connect to the port 443 (https) of www.paypal.com when the firewall is disabled. So try to connect to www.paypal using curl:

Code: [Select]
curl -i -X POST -A "WooCommerce/9.7.1; https://testsimulazione.it" https://www.paypal.com/cgi-bin/webscr
You should get headers from the server and raw HTML if connection is established. In other case, if the connection fails, check response headers.

Offline
*
Re: wp_remote_post() failed
« Reply #11 on: March 18, 2025, 08:55:46 PM »
Hi! I solved it by changing the server, because having problems with Centos 9 and Almalinux 9, the processor was not compatible with older installations. I have now installed Almalinux 8 on a new server and I am configuring CWP at best.