Yahoo Rank Checker: PHP function to get Yahoo rank for keyword
29
May
May
In PHP and Scripting |
On 29th May 2010
Here is the function to get Yahoo rank for your keyword and domain. Yahoo Rank Checker.
As with the Googlerank function in the previous post, if you want the function to search through more yahoo pages
change the for($i=0;$i<5;$i++){ line in the code.
Enjoy!
Next will a function to get your ranking in "Bing".
As with the Googlerank function in the previous post, if you want the function to search through more yahoo pages
change the for($i=0;$i<5;$i++){ line in the code.
Enjoy!
Next will a function to get your ranking in "Bing".
/* Function to get ranking position of domain for given keyword.
* var $keyword [string]
* var $domain [string] | www.domain.com | domain.com
* Whichever you expect your domain to be listed with or without www prefix.
*/
function yahoorank($keyword,$domain){
$rank = '0';
$urls = array();
for($i=0;$i<5;$i++){
$rn=$i=='0'?'':$i;
$query = "http://search.yahoo.com/search?p=".urlencode($keyword)."&b=".$rn."1";
$result_page = file_get_contents($query);
preg_match_all('/class="yschttl spt" href="(.*?)">/',$result_page,$matches);
foreach($matches[1] AS $url){
$urls[] = $url;
}
}
//print_r($urls);exit();
for($i=0;$i< count($urls);$i++){
if(stristr($urls[$i],'http://'.$domain)){
$rank = $i +1;
break;
}
}
return $rank;
}
Leave a Comment

RSS
at 2010-08-13 02:53:53
thank you for sharing
at 2011-08-02 02:46:46
Thank you sharing yahoo and all other engine search code
at 2012-01-15 23:49:59
louis vuitton bags | chanel bags | fake chanel