You do realize that such a script needs to run on another server, not the server you are trying to monitor? Do you have such a server available?
The script itself is very easy to build in PHP. In pseudo code:
$content = file_get_contents("http://yourserver/check.php");
if($content != 'expected content) {
mail('webmaster@yourserver', 'Serverdown', 'Just to let you know.');
}
Just schedule this script to run every minute or so in a crontab.
In check.php on your server you could just put a plain HTML file or you could include some database connection logic so to test the running of your database server as well.
A side effect of this construction is that there will be a line in your access log everytime the script checks the server. This could lead to "stat polution", so if you process your logfiles into stats, I would filter out any access to the check.php page.