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.


Recommended Answers

All 4 Replies

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.

Ive already made the script to check if the code is on the site. See: http://www.daniweb.com/forums/thread350324.html

Any way of using what I already have and combine it with the database?

Thanks telling about this sleep function, i shall look into it.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.