Cougar
Admin Admin
| Beiträge: 622 |  |
|
Re:Frage zum PHP-Backlink-Script - 04/09/2007 20:00
Hallo Tomy,
leider hast du recht.
Ich hab es gerade getestet und mehrere Fehler endeckt.
Hier der Code der funktioniert:| Code: | <?php
function cleaner($data) {
$data = strip_tags($data);
$data = strtolower($data);
$data = str_replace("\n", '', $data);
$data = str_replace("\r", '', $data);
return $data;
}
// zu überprüfende URL:
$target = "www.hoerandl.com";
$source = "http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=link%3A".$target;
$start = "of about";
$smlen = 9 ;
$stop = "linking";
$fail = "did not match any documents";
$data = @implode('', @file($source));
$data = cleaner($data);
if(substr_count($data, $fail)) $google = "kein Resultat";
else {
$data = substr($data, strpos($data, $start)+$smlen);
$data = substr($data, 0, strpos($data, $stop));
$google = trim($data);
}
// weniger als 11
if(substr_count($google, (eregi_replace('www.', '', $target)))) {
$start = "results";
$smlen = 17 ;
$data = cleaner($google);
$data = substr($data, strpos($data, $start)+$smlen);
$google = trim($data);
}
// Ausgabe verlinken
$source = str_replace('&','&', $source); // W3C Valid
$google = "<a href=\"".$source."\" target=\"_blank\">".$google."</a>"; // Verlinkung
echo "Anzahl der gelisteten Backlinks bei Google für \"".$target."\": ".$google;
?>
|
LG,
Cougar
|