Forum Moderators: coopster
I could really use some advice on this one from you guys.
I believe this topic goes here under "Server Side Scripting", but do correct me if I'm wrong !
I have (still building it) a web site that collects news and articles from various regional news sources. Headlines are displayed "live", that is - there are ajax updaters which check if new articles have been published.
The path to the final displayed page is rather long:
1.check numerous news sites
2.first check the current status of their RSS list
3.according to the specific RSS link load the given page (with file_get_contents) and extract the article image link (yep, only a few sources list their images inside the rss list)
4.for every source the process is somewhat different, in order to extract image there are loops and substr-s and preg_replaces-s all over : )
5.explode the article and figure out the most important keywords and save them to DB as tags
6. and so on, and so on...
Last results are saved into DB and when the page loads it fetches those results before heading for a new snooping adventure, so the initial loading time is rather quick.
Now I have ajax updater which checks for new articles (the long process described above) every 30 seconds.
This is ok for now, as obviously I'm the only viewer, but if I had more people viewing the page, that would be an ajax jungle out there.
So, I was thinking of separating the big process into an automated single cron job and have ajax updaters just pull the last results from DB.
Is this a good way to go?
I have it running as we speak, basically I have a page with all my required actions opened in a tab with a javascript refresh set to 60 seconds.
But in order to update DB, I'd have to have my computer on 24/7 right? : )
Or should I talk to my hosting company? I'd rather do it all by myself though, as I have some spare old computers that I could use for the job.
Anyone, thanks for reading, all advices on the subject are welcome !
Anyway, I dump the wholle output to DB and then just call the finished code into the browser. Using it like this I reduced the page loading time from 7 seconds to 0.7 seconds ! Wow : )