我需要在页面发生变化时向我发送电子邮件的脚本。这是我的代码,但它不能正常工作。我怎样才能做到这一点才能正常工作?
$new_page = file_get_contents('http://www.google.com');
$new_page_in = mysql_real_escape_string($new_page);
mysql_query("UPDATE new SET text='$new_page_in' WHERE id='1'") or die (mysql_error());
$sql1 = mysql_query("SELECT text FROM new WHERE id='1'") or die (mysql_error());
list($new_out) = mysql_fetch_row($sql1);
$sql2 = mysql_query("SELECT text FROM old WHERE id='1'") or die (mysql_error());
list($old_out) = mysql_fetch_row($sql2);
if($new_out != $old_out)
{
$new_page = file_get_contents('http://www.google.com');
$new_page_in = mysql_real_escape_string($new_page);
mysql_query("UPDATE old SET text='$new_page_in' WHERE id='1'") or die (mysql_error());
echo "Text is diferent.";
//send email
}
else
{
echo "Text isn't diferent";
}