Yesterday while I was busy updating a couple of my WordPress blogs, on one of the blogs I kept on getting an unexpected error when I was trying to add and update plugins – An unexpected HTTP Error occurred during the API request.
To be honest, I was totally baffled by this error as this was the first time I got the error. This was a really big problem because I wasn’t able to update or add any of the necessary plugins to make the WordPress website work.
Research research research
After searching and doing some research on ways to fix this error I realised that this was quite a common error and there are a lot of people who had this error before. All the fixes that I have found online was for WordPress versions prior to 3.0 and it involves editing the http.php file in the
wp-includes folder found on the root of your WordPress installation.
Here’s the fix that I have found. Find this code on-line no 223 in http.php in the wp-includes folder.
{code type=PHP}
‘timeout’ => apply_filters( ‘http_request_timeout’, 5);
{/code}
Replace that code with:
{code type=PHP}
‘timeout’ => apply_filters( ‘http_request_timeout’, 30);
{/code}
This will not work if you are running a WordPress version 3 or higher as the above code is not in the http.php file anymore but in the class-http.php file also found in the wp-includes folder.
By replacing the code above resolved the nasty HTTP error I was getting. Hope it works for you!
i really tried it , changed the timeout to 30 but nothing happened , and this problem really worry me, can this problem caused from the host ?
http://www.health2b.com
It doesnt work in mine too…is there any other solution?
cream office chair
For anyone who’s still having this problem:
Try changing your nameserver IP’s to a different upstream DNS server. If your upstream DNS server is either off, too slow or having problems then you’ll get this issue as well.
ping api.wordpress.com and see how quickly you get a response. If it takes a while to start showing the IP address, or ping responses (even if the ping responses are fast) then the DNS server is problematic and should be changed
Thank you! This really helped me!
TM
I am glad it worked for you.
This really helped me. Thank you
I have edited class-http.php and put 30 into ‘timeout’
but it was not working.
the error message “An Unexpected HTTP Error occurred during the API request.” keep occur
What is the URL of your site? Have you tried any other solutions to fix the problem?
http://dakayo.com/
coud you explaing how you fix the problems with this menssage:An Unexpected HTTP Error occurred during the API request.
I try install a new themes.
Thank
I was not sure what I was doing, but the error now never occur
i installing wordpress 3.2.1 i have this error when i try installs new themes
An Unexpected HTTP Error occurred during the API request.
please help me
Did you follow the solution as I explained in the post?
yes i follow the instruction, i changed the seting int class-http.php to 30 into timeout. but it was not working, it the same problems with Edsbali
hallo brother, on WordPress 3.1 or higher setting file on class-http.php
oke thank you
WordPress 3.2.1 setting time out on file class-http.php
Thank you
http://massol507.wordpress.com
I made the change of 5 to 30 in the class-http.php file on a local installation. I only have backup buddy and akismet as plug-ins. Any suggestions?