Parser for determining Google Position
Posted: Mon Jan 30, 2006 8:54 am
Jcart | Please use
Thanks,
visionmaster
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hello together,
I wrote a PHP parser which takes a searchword as input and outputs the position and page no. of my webpage found in the google result page. Everything works fine, but strangely my parser often outputs a different result than a direct search does for a product in google. My parser may show position 2 for a search word, whereas searching via browser, my webpage is placed at position 4. How can that be? Does google determine some client variables and therefore shows another result page? Any ideas how I can solve this problem?Code: Select all
<?php $string = getPageUsingCurl("http://www.google.de/search?num=100&hs=T2D&hl=de&client=firefox-a&rls=org.mozilla%3Ade%3Aofficial&q=."$strSearchstring".&btnG=Suche&meta=lr%3Dlang_de");
/*********************************************************************
Funktion: Get's a web page into a string using the cURL library
Eingabe : URL
Ausgabe : String
*********************************************************************/
function getPageUsingCurl($url) {
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);
//Bei keinem Fehler ist ein leerer String Rückgabewert
if( curl_error($ch) <> '')
{
$string = curl_error($ch);
$ret["exitcode"]=-1;
return $ret;
}
curl_close ($ch);
//Liefert den Inhalt der Webpage zurück
return $result;
}
?>visionmaster
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]