
Backlink Check
Dieses Schnipsel prüft, ob ein bestimmter Link sich auf einer anderen Seite befindet.
|
|
<?php
function check_back_link($remote_url,$link) {
$match_pattern = preg_quote(
rtrim($link,"/"),"/");
$found = false;
if ($handle = @fopen($remote_url, "r")) {
while (!feof($handle)) {
$part = fread($handle, 1024);
if (preg_match("/<a(.*)href=[\"']
".$match_pattern."(/?)["'](.*)>
(.*)</a>/", $part)) {
$found = true;
break;
}
}
fclose($handle);
}
return $found;
}
//Beispiel
if (check_back_link("http://www.X.de",
"http://www.X.de")) {
echo "Link existiert.";
}
?>
|
|
|