I was pulling my hair out for a few days trying to resolve this error. A lot of web sites stated that I had to change the http.php timeout value and that would fix the problem – but it didn’t.
Then a thought came to me (yep, I have them once and a while), why not upgrade my PHP version to the latest version. I have version 5.2.something. After I upgraded to PHP version 5.3.8 all my API problems disappeared.