Um die Code Reihe von gestern mal fortzusetzen, hier ein weiterer Schnippsel, der einem die Links zurück gibt, die google bei “link:domain.de” anzeigt.
Das ganze ist mit PHP, Curl und regexp realisiert.

Wichtig: XXX muss durch < ersetzt werden, da WordPress den Code sonst zerhaut.

class base
{

	function crawlUrl($url)
	{

		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
		curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204");
		if (!($contents = trim(@curl_exec($ch)))) {
			$this->debugRes("error","curl_exec failed");
		}
		curl_close ($ch);

		return $contents;

	}
}

function getBacklinks($target)
{

  $content = strtolower(base::crawlUrl("http://www.google.de/search?hl=en&source=hp&q=link%3A".$target."&aq=f&aqi=&aql=&oq=&gs_rfai="));
  $content = strip_tags(preg_replace("'XXXstyle[^>]*>.*XXX/style>'siU",'',$content));

  $resultnew=str_replace("about ","",$content);
  $resultnew=substr($resultnew, strpos($resultnew, 'advanced search')+15);
  $resultnew=substr($resultnew, 0, strpos($resultnew, ' result'));

  return trim(str_replace(",","",$resultnew));

}   

echo getBacklinks("http://www.morphex.eu");

Related posts:

  1. Seiten im Google Index mit PHP+Curl anzeigen
  2. Backlinks und Seitenanzahl über den Yahoo Siteexplorer auslesen
  3. Google Suggestions in Keyword Applikation integrieren
  4. Position einer Seite bei Keyword zeigen
  5. Code to Text Ratio mit PHP ausrechnen