リンクチェッカーのスクリプトを取得しました。リンクが正しく機能していないときにメールを差し上げます。 私は同じリンクについて複数の電子メールを受け取らないように、リンクに関するメールを私に送信することを覚えておく必要があります。リンクチェッカー - 無効なリンクのメール
誰もが私にとって難しいので、私はこれを助けてくれると私は賞賛します。
<?
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.";
}
}
?>
コメント、無回答。 "ブール値"として0と1を使用しないでください。 $ working == 1のようなものはあなたのコードを醜いものにし、読みにくいものにします。さらに、$ var1、$ var2などを宣言することは、自分のコードで迷う最善の方法です。 –