|
| Author |
Message |
ibc218
Joined: 16 Dec 2007
Posts: 1
|
Posted: 12/17/2007, 12:28 am Post subject: PHP + slow fopen() |
|
|
Hi,
I have a small application that grabs Yahoo Financial stock quotes for my web page. It's really simple, and the only non-trivial part of the code is this:
$fp = fopen($yahoo_url, "r"); //open the file storing yahoo stock info
This worked fine for a day or so, but now it runs really slow (it now takes 15 seconds to complete when it used to only take two or three). I think it has to do with the fact that my site gets quite a bit of traffic, and requesting this resource so often is getting me into trouble with Yahoo or my host. It's almost like one of them is telling my page "stop doing that" by throttling the request/response.
I'm a PHP n00b, so any help would be much appreciated.
Thanks! |
|
| Back to top |
|
 |
Keith
Moderator
Joined: 28 Jan 2004
Posts: 427
Location: Dublin, Ireland
|
Posted: 12/17/2007, 2:21 pm Post subject: |
|
|
If your requests are being throttled because of your traffic, you would normally look at caching the data. But because it's stock quotes, caching isn't really an option. Instead I would suggest you look for an API or an XML feed that provides the same information. _________________ Keith McLaughlin - DeveloperCube Moderator
Web Hosting Directory - Freelance Web Design - Webmaster Resources |
|
| Back to top |
|
 |
Patrick
Administrator
Joined: 08 Feb 2003
Posts: 1196
Location: Harbinger, NC, U.S.A.
|
|
| Back to top |
|
 |
|