开发者

PHP Function to count no. of yahoo backlinks

开发者 https://www.devze.com 2023-02-01 20:33 出处:网络
I am using this code to check but not getting result. Here I am trying to get backlinks of google.com in yahoo.

I am using this code to check but not getting result. Here I am trying to get backlinks of google.com in yahoo.

$url = "http://www.google.com";
$page = file_get_contents("http://siteexplorer.search.yahoo.com/search?p=$url&bwm=i开发者_StackOverflow社区&bwmf=a&bwms=p");    
$expression = '/<span class="btn">Inlinks \((.*)\)<i class="tl"><\/i>/Us';  
preg_match($expression, $page, $matches);   
print_r($matches);


If you take a look at the source, there's no <i class="tl"></i> after Inlinks (...). Which itself sums up pretty fine why regular expressions are a terrible tool for these kind of things in the first place. Nevertheless, it should work if you use the following expression:

$expression = '/<span class="btn">Inlinks \((.*)\)/';  
0

精彩评论

暂无评论...
验证码 换一张
取 消