Hey! I got this link checker script and i would like it to give me a mail when a link doesnt work. I need it to remember that it send me an email about a link so i dont get multiple emails about the same link.
I would appeciate if anyone help me with this since it was too hard for me.
<?
function checklink($links) {
$working = 0;
$link = $links;
$links = preg_replace('/\s+/', '', $links);
if(strstr($links,"rapidshare.com")){
$var = file_get_contents($links);
if(strpos($var,"You want to download the file ")) {
$working = 1;
}
}
elseif (strstr($links,"megaupload.com")) {
$var1 = file_get_contents($links);
if(strpos($var1,"Please enter")) {
$working = 1;
}
}
elseif (strstr($links,"megashares.com")) {
$var2 = file_get_contents($links);
if(strpos($var2,"Filename:")) {
$working = 1;
}
}
elseif (strstr($links,"sendspace.com")) {
$var3 = file_get_contents($links);
if(strpos($var3,"404 Page Not Found")) {
$working = 0;
}
elseif(strpos($var3,"Sorry, the file you requested is not available.")){
$working = 0;
}
else {
$working = 1;
}
}
elseif(strstr($links,"rapidshare.de")) {
$var5 = file_get_contents($links);
if(strpos($var,"You want to download the file ")){
$working = 1;
}
}
elseif (strstr($links,"mediafire.com")) {
$var4 = file_get_contents($links);
if(strpos($var4,"Sharing")) {
$working = 1;
}
}
if ($working == 1) {
echo "<a href=\"". $link . "\" target=\"_blank\">". $link . "</a>";
}
else {
echo "The link is not working. Please let me know about it and I'll fix it.";
}
}
?>