I've already asked a few questions in this regard, but still have things that are not clear to me.
I was looking for a mechanism that, while being constantly run from a free remote server (which is not my computer), would check a web-page by its URL every 20 minutes, record its 开发者_运维技巧HTML code (i.e. source), store it in a file or send it to me by e-mail.
Well, I have already been told that this thing would be possible with Google Appi Engines, but I have just stumbled upon a PHP-supporting server and have discovered that PHP can do a lot of things that are very close to what I want to do.
So, my question is: do you think any free PHP supporting server would allow me that kind of task. (Do you know of any?) As far as I know, not all free PHP servers allow e-mailing.
Thank you all in advance.
You could set up a cron job to run a PHP script that does just that. For example, the command in the cron job definition would be something like this
php /path/to/php-script.php
and the "php-script.php" file would look something like this
$fileAr = file("http://website-you-want-to-check/html-file");
$fileContentString = "";
for ($fileAr as $thisLine) {
$fileContentString .= trim($thisLine) . "\n";
}
mail("you@domain.com","Website Source Code",$fileContentString,"From: from-addr@domain.com");
This is obviously realy simplistic, but It'll do the job.
Alternatively, you could put the PHP script on a web server. If you're running Windows, you can use the Windows version of WGET to run the script remotely.
I should mention that you might need to modify some settings in your php.ini file (can't remember what ones off the top of my head though).
Any server that allows you to install your own cron jobs can do this. Just write a PHP script to do what you need and then set up a cron job to run that script at whatever interval you need (in this case I guess it would be every 20 minutes).
HOW to do this specifically would be a question to ask on ServerFault.
精彩评论