In the middle of the course, I am working on/ thinking about the final project. Part of it is getting and storing short news messages from a news site. Since there is no RSS-feed, I've made a php-program that screen scrapes the messages and the headlines, and puts them in a MySQL-tabel. This works fine if I request the php-file in the browser.
The code puts the list of headlines in an associative array (called $index). After at most an hour, I'd like to check if there are any new messages to scrape. I created a loop (while (true)) using sleep(), to compare the new $index-array with the former $index. Only new messages will be inserted in MySQL.
But this means that the php-file needs to execute forever.
Is there a different (smarter) way to make this php-file run say once every 15 minutes. It should run independently of users visiting the site and requesting this php-file.
Thanks for any replies/advices.