I have a script that checks so see if a range websites so see if it has some a sample of code in it.

Is it possible to repeat the script once every 24hours? (CRON?)

If so is it possible to post the website and the result it got in a database or log, so I can view them later.

http://daniweb.com - bleepye = True
http://daniweb.com - ashdajhdahsd = False

If your a bit confused then let me know.


6 Years
Discussion Span
Last Post by BleepyE

It's not us who are confused ;-)

You can put your php script to sleep for one day (see the sleep function) and let it run unterminated. Or you can use PHP from the command line as a script language and call it from a cronjob.
I'd recommend you use wget and grep from the command line to retrieve the site's source code, grep for the string and write the result to a text log file. Then you can load the log file later into a database for statistical evaluation and further processing.


If you are learning PHP, that's fine. In real life I'd rather recommend the linux command line.
The sleep function in this context is rather a joke - I would not trust a PHP program running as a web server module to run longer than a few minutes.
To combine it with a database, learn about php and mysql. Set up a table for URL, search string and result and insert your findings with something like insert into mytable (url,searchstring,result) values ('$url','$searchstring','result');


Cron seems to be looking best so far.

Im gonna do some work and see what I can do.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.