Web サイトの Baidu 検索および Sogou 検索のインデックス コードを取得します。検索エンジンに含まれる Web サイトのドメイン名の数を取得するために使用できます。この API をずっと見つけたいと思っていましたが、見つからなかったので、学習して修正した後、Baidu 検索と Sogou 検索に含まれるボリュームを通常は取得できます。検索エンジンのサイト:ドメインの結果の数を取得し、この数をクロールして表示します。
<meta charset="utf-8"><?phpfunction baidu($url){ $baidu="http://www.baidu.com/s?wd=site:".$url; $site=file_get_contents($baidu); ereg("该网站共有(.*)个网页被百度收录", $site,$count); $count=str_replace("该网站共有","",$count); $count=str_replace("个网页被百度收录","",$count); $count=str_replace(",","",$count); $count=str_replace(" ","",$count); return strip_tags($count[0]); } function sogou($url){ $sogou="http://www.sogou.com/web?query=site:".$url; $site=file_get_contents($sogou); ereg("找到约 (.*) 条结果", $site,$count); $count=str_replace("找到约","",$count); $count=str_replace("条结果","",$count); $count=str_replace(",","",$count); $count=str_replace(" ","",$count); return strip_tags($count[0]); }?>www.iteye.com 百度收录<?php echo baidu('www.iteye.com');?>条<br>www.iteye.com 搜狗收录<?php echo sogou('www.iteye.com');?>条
?
レンダリング:
?
?
?