tags:

views:

76

answers:

3

I'm creating a bot in PHP that continuously updates an RSS-feed and gathers information. Every loop takes around 0.1 sec but sometimes it takes up to 9 sec to finish the cycle.

Why does this happen and is there a way around the problem? I need the bot to be as fast as possible as I'm trying to beat another bot that has the same purpose as mine.

+1  A: 

I believe you're using the wrong tool for the job, if you need low latency push-updates you should go with XMPP, Comet or the like.

But if you have to go with RSS, is there any possibility that you keep the connection open instead of closing it?

Viktor Klang
A: 

Yeah, I have to use RSS (or file_get_contents and regexp out the information needed, but that is, well, yeah, slow). I'm not very advanced in PHP, so can you point me in a direction of how to keep an open connection to the rss-feed?

bluelime
A: 

Why not run a background task on your machine? Using crontabon linux for example. That task parses your RSS feeds and writes the data to either a database or stores the parsed data into some kind of file format such as XML or JSON.

Kolky