统计结果:
1、CU:最后统计的空间浪费结果是:2282M end time:2010-04-04 11:38:40, 主题: 351641 , 帖子: 1432244, 会员: 23633797,创建于2003-2-10
2、化工:最后统计的空间浪费结果是:88M end time:2010-04-05 8:52:40, 主题: 3548, 帖子: 9608, 会员: 19094,创建于2007-2-4
3、人大经济论坛:今日: 1216, 昨日: 11562, 最高日: 16583 , 主题: 585770, 帖子: 4881335, 会员: 1721538,创建于2004-5-23
4、起点手机论坛,http://www.dimboy.cn/index.php,
5、我要玩手机论坛,http://bbs.512530.com/512530.php,今日:
2201, 昨日:
12656, 会员:
4048683
第一版:[2010-3-31]
<?php
$url = "http://linux.chinaunix.net/bbs/thread-1128442-1-1.html";
$ch = curl_init();
$timeout = 5;
$sum = 0;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
$path = '/tmp';
$p = opendir($path);
if(is_dir($path)){
chdir($path);
echo scandir($p);
$ereg = '.*';
ereg($ereg,$contents,$outcome);
print_r($outcome);
// foreach($outcome as $string)
// echo $string.'
';
//$sum += strlen($string);
file_put_contents(web,$sum);
}else
echo "$path is not dir";
closedir($path);
?>
第二版:[2010-4-1]
<?php
define("CU","http://linux.chinaunix.net/bbs/forum-64-");
// $url = "http://linux.chinaunix.net/bbs/thread-1128442-1-1.html";
//判断网页链接是否已经到头[未完成!]
function isLinkEnd($url1,$url2){
$page1 = file_get_contents($url1);
$page2 = file_get_contents($url2);
$startword = ' ';
$endword = '';
$startpos1 = strpos($page1,$startword);
$endpos1 = strpos($page1,$endword);
$startpos2 = strpos($page2,$startword);
$endpos2 = strpos($page2,$endword);
$result1 = strstr($page1,$startpos1+strlen($startword),$endpos1-$startpos1-$strlen($startword));
$result2 = strstr($page2,$startpos2+strlen($startword),$endpos2-$startpos1-$strlen($startword));
return ($result1 == $result2?0:1);
}
//自动抽取chinaunix.net上含有回复下载的所有链接,保存为数组返回[已完成!]
function linksOf(){
$page = 1;
$thisurl = CU."$page".'.html';
while( $page $links1[] = $thisurl;
$page++;
$thisurl = CU."$page".'.html';
}
return $links1;
}
//自动检查所有链接的分页页面地址,保存为数组返回[已完成!]
function linksOfPart($links1){
foreach($links1 as $linksBefore){
$contents = file($linksBefore);
$ereg1 = ' }
}
}
return $linksPerArticle;
}
//自动检查所有链接地址,保存为数组返回[尚未完成!]
function linksOfAll($linksPerArticle){
foreach($linksPerArticle as $linksBefore){
$contents = file($url);
}
return $linksOfAll;
}
//计算打开的每页无效字符字节数[已完成!]
function countPerPage($url){
$contents = file($url);
$sum = 0;
$ereg1 = '
1、CU:最后统计的空间浪费结果是:2282M end time:2010-04-04 11:38:40, 主题: 351641 , 帖子: 1432244, 会员: 23633797,创建于2003-2-10
2、化工:最后统计的空间浪费结果是:88M end time:2010-04-05 8:52:40, 主题: 3548, 帖子: 9608, 会员: 19094,创建于2007-2-4
3、人大经济论坛:今日: 1216, 昨日: 11562, 最高日: 16583 , 主题: 585770, 帖子: 4881335, 会员: 1721538,创建于2004-5-23
4、起点手机论坛,http://www.dimboy.cn/index.php,
今日: 1687, 昨日: 8143, 会员: 44822
第一版:[2010-3-31]
<?php
$url = "http://linux.chinaunix.net/bbs/thread-1128442-1-1.html";
$ch = curl_init();
$timeout = 5;
$sum = 0;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
$path = '/tmp';
$p = opendir($path);
if(is_dir($path)){
chdir($path);
echo scandir($p);
$ereg = '.*';
ereg($ereg,$contents,$outcome);
print_r($outcome);
// foreach($outcome as $string)
// echo $string.'
';
//$sum += strlen($string);
file_put_contents(web,$sum);
}else
echo "$path is not dir";
closedir($path);
?>
第二版:[2010-4-1]
<?php
define("CU","http://linux.chinaunix.net/bbs/forum-64-");
// $url = "http://linux.chinaunix.net/bbs/thread-1128442-1-1.html";
//判断网页链接是否已经到头[未完成!]
function isLinkEnd($url1,$url2){
$page1 = file_get_contents($url1);
$page2 = file_get_contents($url2);
$startword = ' ';
$endword = '';
$startpos1 = strpos($page1,$startword);
$endpos1 = strpos($page1,$endword);
$startpos2 = strpos($page2,$startword);
$endpos2 = strpos($page2,$endword);
$result1 = strstr($page1,$startpos1+strlen($startword),$endpos1-$startpos1-$strlen($startword));
$result2 = strstr($page2,$startpos2+strlen($startword),$endpos2-$startpos1-$strlen($startword));
return ($result1 == $result2?0:1);
}
//自动抽取chinaunix.net上含有回复下载的所有链接,保存为数组返回[已完成!]
function linksOf(){
$page = 1;
$thisurl = CU."$page".'.html';
while( $page $links1[] = $thisurl;
$page++;
$thisurl = CU."$page".'.html';
}
return $links1;
}
//自动检查所有链接的分页页面地址,保存为数组返回[已完成!]
function linksOfPart($links1){
foreach($links1 as $linksBefore){
$contents = file($linksBefore);
$ereg1 = ' }
}
}
return $linksPerArticle;
}
//自动检查所有链接地址,保存为数组返回[尚未完成!]
function linksOfAll($linksPerArticle){
foreach($linksPerArticle as $linksBefore){
$contents = file($url);
}
return $linksOfAll;
}
//计算打开的每页无效字符字节数[已完成!]
function countPerPage($url){
$contents = file($url);
$sum = 0;
$ereg1 = '
define("CU_F","http://linux.chinaunix.net/bbs/thread-"); // $url = "http://linux.chinaunix.net/bbs/thread-1128442-1-1.html"; //判断网页链接是否已经到头[已完成!] function isLinkEnd($url1,$url2){ $page1 = file_get_contents($url1); $page2 = file_get_contents($url2); $startword = ''; $endword = ''; $startpos1 = strpos($page1,$startword); $endpos1 = strpos($page1,$endword); $startpos2 = strpos($page2,$startword); $endpos2 = strpos($page2,$endword); $result1 = substr($page1,$startpos1+strlen($startword),$endpos1-$startpos1-strlen($startword)); $result2 = substr($page2,$startpos2+strlen($startword),$endpos2-$startpos1-strlen($startword)); //返回0说明到头,返回1尚未到头 return ($result1 == $result2?0:1); } //自动抽取chinaunix.net上含有回复下载的所有链接,保存为数组返回[已完成!] function linksOf(){ $page = 1; $thisurl = CU."$page".'.html'; while( $page $links1[] = $thisurl; $page++; $thisurl = CU."$page".'.html'; } return $links1; } //自动检查所有链接的分页页面地址,保存为数组返回[已完成!] function linksOfPart($links1){ foreach($links1 as $linksBefore){ $contents = file($linksBefore); $ereg1 = ' } } } return $linksPerArticle; } //自动检查所有链接地址,保存为数组返回[已完成!] function linksOfAll($linksPerArticle){ foreach($linksPerArticle as $links){ $i = 1; $page_before = CU_F."$links-$i".'-1.html'; $i++; $page_after = CU_F."$links-$i".'-1.html'; while(isLinkEnd($page_before,$page_after)){ $linksOfAll[] = $page_before; $page_before = $page_after; $i++; $page_after = CU_F."$links-$i".'-1.html'; } $linksOfAll[] = $page_before; } return $linksOfAll; } //计算打开的每页无效字符字节数[已完成!] function countPerPage($url){ $contents = file($url); $sum = 0; $ereg1 = '
|