function GoogleLinks($url) {
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: nb-NO,nb;q=0.8,no;q=0.6,nn;q=0.4,en-US;q=0.2,en;q=0.2";
$header[] = "Pragma: ";
$G_url = 'http://www.google.com/search?hl=en&lr=&q=site:'.$url.'&btnG=Search';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $G_url);
curl_setopt($curl, CURLOPT_FAILONERROR,true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7');
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($curl, CURLOPT_AUTOREFERER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
$index = curl_exec($curl);
curl_close($curl);
if (isset($index)) {
preg_match( '#<div id=resultStats>(.*?)<nobr>#si', $index, $indexed );
if (isset($indexed[1])) {
$indexed = preg_replace('/[^0-9\,]/', '', $indexed[1]);
}else{
$indexed = "Fant ingen linker i Google";
}
}else{
$indexed = "Kunne ikke hente dette fra Google";
}
echo $indexed;
}