DeveloperCube - PHP + slow fopen()
Discuss internet community strategy at CommunityAdmins.com
Username:    Password:
Remember Me?    
PHP + slow fopen()

 
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming
 See a User Guidelines violation? Please contact us.
Author Message

ibc218

Joined: 16 Dec 2007
Posts: 1

PostPosted: 12/17/2007, 12:28 am    Post subject: PHP + slow fopen() Reply with quote

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

PostPosted: 12/17/2007, 2:21 pm    Post subject: Reply with quote

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.

PostPosted: 12/17/2007, 4:17 pm    Post subject: Reply with quote

Welcome ibc218. Smile
_________________
Patrick O'Keefe - DeveloperCube Administrator | Articles
Have a suggestion or a bit of feedback relating to DeveloperCube? Please contact me!
Link To Us - User Guidelines
WebDevBooks.com - The Official Bookstore of DeveloperCube
Back to top
Display posts from previous:   
Post new topic   Reply to topic    DeveloperCube Forum Index -> Scripts and Programming All times are GMT
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Writing Scene - Readers Unbound - Literature Vault - Chrispian - Webmaster's Weekly - Writing Prompts - Programming Forum - We Heart Pets - Anita Blake - Harry Dresden - Art Schools Online

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - MarianoRivera.com - PhinsBlog.com - phpBBHacks.com - WebDevBooks.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - CommunityPromotion.com - PhotoshopForums.com - MicrosoftBlog.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

We Support phpBBHacks.com. Forum Icons by Daz. Privacy Policy. Powered by phpBB © phpBB Group. phpBB SEO.
Copyright © 2003-2008. DeveloperCube, iFroggy Network. All Rights Reserved.

Advertising   Contact   Links   Link To Us   Staff   User Guidelines