源码下载地址到http://www.im286.com/viewthread.php?tid=7402791&extra=,我就不上传附件了.下面是两个主要文件,注意要支持php的web服务器,并且安装zend framework库,开启pdo,然后访问以下两个文件的php程序,一个是抓取推广地址,一个是自动推广.<?php
set_time_limit(0);
session_start();include('./include/common_fun.php');
include('Zend/Db.php');mb_internal_encoding("GBK");extract($_REQUEST);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询外链收集小工具:power by http://www.xiao688.com</title>
</head><body>
<?php$params = array ('host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'tools');$db = Zend_Db::factory('PDO_MYSQL', $params);
$db->query("set names gbk");if(!$site=$db->fetchOne("select domain from outlinksearchsite where g=0")){
echo 'finish';die();
}if(strpos($site,'www')!==false){
$wwwdomain=$site;
$domain=str_replace('www','',$site);
}else{
$wwwdomain = $domain = $site;
}
$pn=0;$sleep=0;$addurl=0;
$gfc=file_get_contents('urls.txt');
$collecturls=explode("\r\n",$gfc);while($pn<50){
$pagec=getcontent('http://www.baidu.com/s?wd=domain%3A'.$domain.'%20inurl%3A'.$domain.'&pn='.$pn);
if(preg_match_all('|<table cellpadding="0" cellspacing="0" class="result"(.+?)</table>|is',$pagec,$matchs)){
foreach($matchs[1] as $urlblock){
if(preg_match('/href="(.+?)"/is',$urlblock,$url)){
//取得收集网址
$urlpart=parse_url($url[1]);
if(strpos($urlpart['host'],'www')===0&&strpos($urlpart['host'],$domain)===false){
$haveone=$db->fetchOne("select count(*) as c from outlinksearchsite where domain='{$urlpart['host']}'");
if($haveone<1){
$db->query("insert outlinksearchsite set domain='{$urlpart['host']}'");
}
}
//含有域添加到列表
$s=array($wwwdomain,$domain);
$r=array('{$2}','{$1}'); if(strpos($urlpart['path'].$urlpart['query'],$domain)!==false){
if(strpos($gfc,$urlpart['host'])===false){
$gfc.=$url[1];
$collecturls[]='10000|'.str_replace($s,$r,$url[1]);
echo $url[1],'<br/>';
$addurl++;
flush();
}
}
}
}
}else{
break;
}
$pn+=10;
if($sleep){sleep($sleep);}
}$db->query("update outlinksearchsite set g=1 where domain='{$site}'");if($addurl){
$h=fopen('urls.txt','w');
fwrite($h,implode("\r\n",$collecturls));
fclose($h);
}$time='3000';
?>
收集完成,准备收集下一网址中...
</body>
</html>
<script type="text/javascript" language="javascript">
setTimeout("gonext()",<?=$time?>);
function gonext(){
location.reload();
}
</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>超级反链小工具</title>
</head><body>
<?php
if(isset($_GET['url'])){
$file=$_GET['file']?$_GET['file']:'urls.txt';
$urls=file($file);
if(!is_numeric($_GET['url'])){$_GET['url']=0;}
if(!isset($urls[$_GET['url']])){
echo "地址不存在或者已完成!";die();
}else{
if(strpos($urls[$_GET['url']],'|')>0){
list($time,$url)=explode('|',$urls[$_GET['url']]);
}else{
$time=5000;
$url = $urls[$_GET['url']];
}
}
if(!$url){die();}
$sites=file('sites.txt');
foreach($sites as $key=>$siteurl){
$sites[$key]=explode('|',$siteurl);
$sitesvar=array('{$1}','{$2}','{$3}');
$returnurl[$key]=str_replace($sitesvar,$sites[$key],$url);
}
}
?>
<?php
if(is_array($returnurl)){
foreach($returnurl as $url){
?>
<div>
<h2><?=$url?></h2>
<iframe src="<?=$url?>" width="100%" height="150" frameborder="1" scrolling="auto"></iframe>
</div>
<?php
}
}
?>
</body>
</html>
<script type="text/javascript" language="javascript">
setTimeout("gonext()",<?=$time?>);
function gonext(){
location.href="?url=<?=++$_GET['url']?>";
}
</script>
set_time_limit(0);
session_start();include('./include/common_fun.php');
include('Zend/Db.php');mb_internal_encoding("GBK");extract($_REQUEST);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询外链收集小工具:power by http://www.xiao688.com</title>
</head><body>
<?php$params = array ('host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'tools');$db = Zend_Db::factory('PDO_MYSQL', $params);
$db->query("set names gbk");if(!$site=$db->fetchOne("select domain from outlinksearchsite where g=0")){
echo 'finish';die();
}if(strpos($site,'www')!==false){
$wwwdomain=$site;
$domain=str_replace('www','',$site);
}else{
$wwwdomain = $domain = $site;
}
$pn=0;$sleep=0;$addurl=0;
$gfc=file_get_contents('urls.txt');
$collecturls=explode("\r\n",$gfc);while($pn<50){
$pagec=getcontent('http://www.baidu.com/s?wd=domain%3A'.$domain.'%20inurl%3A'.$domain.'&pn='.$pn);
if(preg_match_all('|<table cellpadding="0" cellspacing="0" class="result"(.+?)</table>|is',$pagec,$matchs)){
foreach($matchs[1] as $urlblock){
if(preg_match('/href="(.+?)"/is',$urlblock,$url)){
//取得收集网址
$urlpart=parse_url($url[1]);
if(strpos($urlpart['host'],'www')===0&&strpos($urlpart['host'],$domain)===false){
$haveone=$db->fetchOne("select count(*) as c from outlinksearchsite where domain='{$urlpart['host']}'");
if($haveone<1){
$db->query("insert outlinksearchsite set domain='{$urlpart['host']}'");
}
}
//含有域添加到列表
$s=array($wwwdomain,$domain);
$r=array('{$2}','{$1}'); if(strpos($urlpart['path'].$urlpart['query'],$domain)!==false){
if(strpos($gfc,$urlpart['host'])===false){
$gfc.=$url[1];
$collecturls[]='10000|'.str_replace($s,$r,$url[1]);
echo $url[1],'<br/>';
$addurl++;
flush();
}
}
}
}
}else{
break;
}
$pn+=10;
if($sleep){sleep($sleep);}
}$db->query("update outlinksearchsite set g=1 where domain='{$site}'");if($addurl){
$h=fopen('urls.txt','w');
fwrite($h,implode("\r\n",$collecturls));
fclose($h);
}$time='3000';
?>
收集完成,准备收集下一网址中...
</body>
</html>
<script type="text/javascript" language="javascript">
setTimeout("gonext()",<?=$time?>);
function gonext(){
location.reload();
}
</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>超级反链小工具</title>
</head><body>
<?php
if(isset($_GET['url'])){
$file=$_GET['file']?$_GET['file']:'urls.txt';
$urls=file($file);
if(!is_numeric($_GET['url'])){$_GET['url']=0;}
if(!isset($urls[$_GET['url']])){
echo "地址不存在或者已完成!";die();
}else{
if(strpos($urls[$_GET['url']],'|')>0){
list($time,$url)=explode('|',$urls[$_GET['url']]);
}else{
$time=5000;
$url = $urls[$_GET['url']];
}
}
if(!$url){die();}
$sites=file('sites.txt');
foreach($sites as $key=>$siteurl){
$sites[$key]=explode('|',$siteurl);
$sitesvar=array('{$1}','{$2}','{$3}');
$returnurl[$key]=str_replace($sitesvar,$sites[$key],$url);
}
}
?>
<?php
if(is_array($returnurl)){
foreach($returnurl as $url){
?>
<div>
<h2><?=$url?></h2>
<iframe src="<?=$url?>" width="100%" height="150" frameborder="1" scrolling="auto"></iframe>
</div>
<?php
}
}
?>
</body>
</html>
<script type="text/javascript" language="javascript">
setTimeout("gonext()",<?=$time?>);
function gonext(){
location.href="?url=<?=++$_GET['url']?>";
}
</script>
pdo是趋势,一直想用,可是程序已经开发到2/3了,想全部修改成pdo太麻烦了.