Yii supplement


I have a question:

I want to build an web application that does these:

(1) Collects and parses XML files (from a URL) every 5-10 minutes

(2) Screen scrapes data (from a URL) every 5-10 minutes

(3) Puts the data from (1)+(2) to MySQL database

(4) Checking and updating some database records when this is necessary (maybe every 5 minutes)

(5) PHP manages and presents the data to the end user

Yii handles the (5) but how about (1),(2),(3) and (4)? PHP is a scripting language and I don’t know if it possible to complete these tasks (time based) with it.

Should I make a Java program for tasks 1,2,3,4 at the database server OR web server?

Does anyone have any practical idea on this?

thankz :)

To solve points 1 to 4 you should probably use any scripting language + cron or any other scheduling software. Since you want to do point 5 in yii its a good idea to use yii for points 1-4 as well. You can easily create console application using yii and consol commands.

Check here http://www.yiiframew.../topics.console

More about cron here http://en.wikipedia.org/wiki/Cron

You should use curl to get the xml data. Its very fast. I think you want to put the xml data into database? Did you want to store the raw xml, or the parsed data?

If you want to store the raw xml into db you could use mysql command line. If you want to store the xml data parsed you could use php it. php is not the fastest xml parser. But you could then create an extension in yii. Which allows you put all "code" in one place and class. Which parser stores, shows and so on the data ( Easier to maintain imho ) If you want "real" speed. And know C++. ( Maybe even without, cause its realy easy ) http://www.ambiera.com/irrxml/ could be something for you. Combine it with mysql and you go.

If it is a “small” project do everything in php :)

Thankz for the replys.

Thanks Q-efx, I am planning to write sth similar to Alch3M1St. You really shed some lights on me.

Not only can Yii do all of this, but it’s quite simple to set up.

  1. Install curl or wget for Windows

  2. Install cron for Windows

  3. Create your frontend app

  4. Create a new controller called CronController

  5. Add your actions (i.e. actionUpdateDatabase)

  6. Add a cron job for each action:

*/5 * * * * c:\path\to\wget http://host/cron/updateDatabase

  1. Enjoy