WordPress solves the problem of "an HTTP Error occurred when requesting an API ".
1. The main reason is that the fsockopen () function is disabled on the host (). The API cannot be called.
Solution: Open/WP-nodes des/class-http.php lookup @ fsockopen (replace with @ pfsockopen (
Find fsockopen (replace with pfsockopen (
Note: Do not replace wp_http_fsockopen (
2. There is another method:
Modify line 220th of WP-DES/class-http.php
'Timeout' => apply_filters ('HTTP _ request_timeout', 5 ),
The value 5 is changed to a large number. The value 5 indicates the request time, in seconds, that is, 5 seconds timeout.
3. Linux I configured locally does not experience timeout. On the other hand, Linux has timed out. Why, later, I unlocked the Code layer by layer, and found that it was slow in domain name resolution. When WP is updated online, it is connected to api.wordpress.org, for example, when installing the template, connect http://api.wordpress.org/themes/info/1.0/, wget http://api.wordpress.org/themes/info/1.0/
and wget http://api.wordpress.org/themes/info/1.0/ speed varies a lot. Later, I changed/etc/resolv. conf to 8.8.8.8.8.