php获取域名的google收录示例

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

function get_index($domain){
$url="http://www.google.com/search?source=hp&biw=1440&bih=762&q=site%3A$domain&aq=f&aqi=g10&aql=&oq=";
$html=file_get_contents($url);
preg_match('/<div id=resultStats>[\S\s].*<nobr>/Ui', $html,$index);
for($i=0;$i<=strlen($index['0']);$i++){
if(is_numeric($index['0'][$i])){
$count.=$index['0'][$i];
}
}
return $count;
}

相关文章

php正则匹配文章中的远程图片地址并下载图片至本地

使用php的正则表达式来实现: $content = '这里是文章内容,这里插入一张图片测试 <img src="XXXXXXXXXXXXXXXXXXXX">'; $c...

PHP中创建空文件的代码[file_put_contents vs touch]

I has passed a small test to check which function is faster to create a new file. file_put_co...

一个简单且很好用的php分页类

复制代码 代码如下:class Page {    // 分页栏每页显示的页数    public $rollPage = 6...

PHP初学者最感迷茫的问题小结

【1】页面之间无法传递变量 get,post,session在最新的php版本中自动全局变量是关闭的,所以要从上一页面取得提交过来得变量要使用$_GET['foo'],$_POST['f...

PHP获取MSN好友列表类的实现代码

复制代码 代码如下:<?phperror_reporting(7);class msn{    private $startcomm = 0;&nbs...