PHP脚本
<?php
$data=file_get_contents('http://directspace.net/vps_dedicated.htm');
$available=strpos($data,"Available October 28th");
if (!$available) {
mail ("yourmail@gmail.com", "WoW! DS2$ Available!", "DS2$ Available,GOGO!");
}
?>
或
<?php
$data=file_get_contents('https://directspace.net/eportal/cart.php?a=add&pid=173');
$available=strpos($data,"Out of Stock");
if (!$available) {
mail ("yourmail@gmail.com", "WoW! DS2$ Available!", "DS2$ Available,GOGO!");
}
?>
Crontab这样写
*/5 * * * * /usr/local/php/bin/php /home/wwwroot/dsmonitor.php
这就行了,如果crontab不能执行,可能是你的系统不支持*/5这样的写法,那你就0,5,10,15,20.....55这样写
from http://www.hostloc.com/thread-32575-1-1.html
<?php
ignore_user_abort();
set_time_limit(0);
while(true)
{
$f = file_get_contents("http:xxxxx");
$m = md5($f);
$hash = file_get_contents("hash.txt");
if($hash!=$m)
{
file_put_contents("hash.txt",$m);
mail("aaa@qq.com","发生变化","内容。。。"); //mail 函数如果使用过多,有些邮箱会让他直接进垃圾邮件或者拒收,本质是调用linux的sendmail 之类发送。
}
echo "执行了一次<br>";
sleep(60*15); //休眠15分钟
}