function google($keywords,$url,$maxpages,$locale="int")
{
if ($locale=="de")
{
$http=new httpconnection("www.google.de",80,false,"Mozilla/5.0");
}
else
{
$http=new httpconnection("www.google.com",80,false,"Mozilla/5.0");
}
$x=0;
while (($x<$maxpages) && ($found==false))
{
$start=$x*10;
$data=$http->get("search","q=".$keywords."&start=".$start);
if ((strpos($data['body'],'//'.$url.'/')!=false) || (strpos($data['body'],'//'.$url.' ')!=false))
{
$found=true;
}
else
{
$found=false;
}
$x++;
}
$data=$http->get("search","q=link:http://".$url);
if ($locale=="de")
{
$nomatchstring="Es wurden keine";
}
else
{
$nomatchstring="did not match";
}
if (strpos($data['body'],$nomatchstring)!=false)
{
$backlinks=0;
}
else
{
if ($locale=="de")
{
$startpos=strpos($data['body'],"von",strpos($data['body'],"Ergebnisse"))+4;
$endpos=strpos($data['body'],",",$startpos);
$aboutword="ungefähr";
}
else
{
$startpos=strpos($data['body'],"of",strpos($data['body'],"Results"))+3;
$endpos=strpos($data['body'],"linking",$startpos)-1;
$aboutword="about";
}
$backlinks=substr($data['body'],$startpos,$endpos-$startpos);
if (substr($backlinks,0,1)==substr($aboutword,0,1))
{
$backlinks=substr($backlinks,3+strlen($aboutword)+1,-4);
}
else
{
$backlinks=substr($backlinks,3,-4);
}
}
unset($http);
echo '<b>Google:</b><br>';
if ($found==true)
{
echo $url.' was found on page '.$x.'<br>';
}
else
{
echo $url.' was not found on the first '.$x.' Pages of results<br>';
}
echo 'Backlinks to '.$url.': '.$backlinks;
echo '<hr>';
}
google ("rolladen", "www.roma.de", "100");