开发者

Web Service Call So Slow, But Fast When Done In Browser?

I'm making web service calls to one of Amazon's APIs using PHP. It takes about 3-4 seconds to get a response from Amazon. However, when I try getting the response via Firefox, response time is < 1 second according to Firebug. This is not a caching issue since I am accessing different URLs for each test. The PHP script uses file_get_contents to get the response from Amazon.

Any ideas why the browser is faster than my script? And what can I do to match the speed of the b开发者_StackOverflowrowser?


If you manage to do the http request from php using the exact same http headers as firefox does then it should get the response in the same time. So maybe you should use a proper http client in PHP.

Otherwise it should be random behavior from the webservice side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜