小偷程序(PHP 搜狗)

<?php
if(empty($_GET['key'])){
    echo '请输入关键词,域名上加?key=';exit;
}

/**************************获取搜搜内容***********************************/
$key = $_GET['key'];
mb_convert_encoding($key,'utf-8','gb2312');
$url = 'https://www.sogou.com/sogou?query='. urlencode($key) .'&insite=wenwen.sogou.com';
//$url = 'https://www.sogou.com/sogou?query=香花槐&_ast=1574942592&_asf=www.sogou.com&w=01029901&pid=sogou-wsse-a9e18cb5dd9d3ab4&duppid=1&cid=&s_from=result_up&insite=wenwen.sogou.com' ;
$content = httpRequest($url);
mb_convert_encoding($content,'utf-8','gb2312');
$str = $content;
$str = str_replace('href="/css/', "https://www.sogou.com/css/", $content);
$str = str_replace('src="/images/', "https://www.sogou.com/images/", $str);
$str = str_replace('src="/js/', "https://www.sogou.com/js", $str);
$str = str_replace('href="/web/css/', "https://www.sogou.com/web/css/", $str);
$str = str_replace('src="/web/images/', "https://www.sogou.com/web/images/", $str);
$str = str_replace('src="/web/js/', "https://www.sogou.com/web/js/", $str);
$str = str_replace('src="/web/img/', "https://www.sogou.com/web/img/", $str);

//替换内容
$search = '/<div class="header" style="">.*?<\/p>(\t|\r\n|\n|\s)*<\/div>/is';
$str = preg_replace($search, "", $str);
$str = preg_replace('/搜狗搜索/', "", $str);
$str = preg_replace('/搜狗/', "", $str);
$str = preg_replace('/站内搜索/', "", $str);
$str = preg_replace('/全网搜索/', "", $str);
$str = preg_replace('/- 问问/', "", $str);
$str = preg_replace('/最佳答案/', "用户评价", $str);
$search = '/<div class="biz_fb">.*?<\/a>(\t|\r\n|\n|\s)*<\/div>/is';
$str = preg_replace($search, "", $str);

$search="/<p class=\"str_time\".*?>.*?<\/p>/ism";
$str = preg_replace($search, "", $str);

$search="/<p class=\"num-tips\".*?>.*?<\/p>/ism";
$str = preg_replace($search, "", $str);

$search = '/<div class="p" id="pagebar_container">.*?<\/a>(\t|\r\n|\n|\s)*<\/div>/is';
$str = preg_replace($search, "", $str);

$search = '/<div class="cr" id="s_footer">.*?<\/div>(\t|\r\n|\n|\s)*<\/div>/is';
$str = preg_replace($search, "", $str);

$search="/<div class=\"fb\".*?>.*?<\/div>/ism";
$str = preg_replace($search, "", $str);

$search="/<div class=\"biz_risk_alert\".*?>.*?<\/div>/ism";
$str = preg_replace($search, "", $str);


//替换链接
$str = preg_replace('/<a .*?href="(.*?)".*?>/is',"<a href='http://www.cctv.com'>",$str);


echo $str;

echo '
 <style>
 .wrapper {
    padding: 0;
}
</style>
';

/**************************获取关键词***********************************/

$url = 'https://www.sogou.com/tx?query='. urlencode($key);

$content = httpRequest($url);
mb_convert_encoding($content,'utf-8','gb2312');

//构造一个div
echo '<div style="padding-left:38em;" class="content_re">';
echo '<h2>相关搜索</h2>';
//1
$search="/<div class=\"hint-mid\">.*?<\/a><\/div>/ism";
//$str2 = preg_replace($search, "", $content);
$str2 = preg_match($search, $content, $res);
$html=preg_replace("(<a[^>]*>(.+?)<\/a>)","<a href='/test.php?key=$1'>$1</a>",$res[0]);
echo $html;


//3
$search = '/<div class="hintBox">.*?<\/table>(\t|\r\n|\n|\s)*<\/div>/is';
$str = preg_match($search, $content, $div);

$html = $div[0];
/*$html = preg_replace('/<a .*?href="(.*?)".*?>/is',"<a href='http://www.cctv.com'>",$html);*/

$html=preg_replace("(<a[^>]*>(.+?)<\/a>)","<a href='/test.php?key=$1'>$1</a>",$html);
$html=preg_replace("/相关搜索/","",$html);
echo $html;

//2
$search="/<p>(\t|\r\n|\n|\s)<a.*?<\/p>/ism";
//$str2 = preg_replace($search, "", $content);
$str2 = preg_match($search, $content,$res);
//替换链接+关键词(test.php 根据自己的改)
$html=preg_replace("(<a[^>]*>(.+?)<\/a>)","<a href='/test.php?key=$1'>$1</a>",$res[0]);
echo $html;

echo '</div>';



//样式写在这
echo '
  <style>
  .hint-mid {
    font-size: 0;
    line-height: 0;
    max-height: 102px;
    overflow: hidden;
    margin-bottom: 0;
    padding: 5px 0;
}
.hint-mid a {
    display: inline-block;
    font-size: 13px;
    line-height: 28px;
    height: 28px;
    padding: 0 7px;
    margin-right: 8px;
    text-decoration: none;
    border: 1px solid #e6e6e6;
    margin-bottom: 8px;
    border-radius: 1px;
}
.content_re{

}
p a {
    white-space: nowrap;
    padding: 4px 8px;
}
.hintBox{
margin-left: 0;
}
</style>
';


//curl 抓取内容
function httpRequest($url, $postData = array())
{
    //curl 伪造useragent
    $useragent = array(
        'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)',
        'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)',
        'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
        'Mozilla/5.0 (Windows; U; Windows NT 5.2) Gecko/2008070208 Firefox/3.0.1',
        'Opera/9.27 (Windows NT 5.2; U; zh-cn)',
        'Opera/8.0 (Macintosh; PPC Mac OS X; U; en)',
        'Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13 ',
        'Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13'
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    if (!empty($postData)) {
        // 设置请求方式为post
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    }
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

    curl_setopt($ch, CURLOPT_ENCODING , 'gzip');

    //添加这两行
//    curl_setopt($ch, CURLOPT_ENCODING, "gzip");
//    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Origin: http://h5.eqxiu.com']);

    // 设置iP和useragent
    curl_setopt($ch, CURLOPT_REFERER, "http://h5.eqxiu.com/s/Rwg9jFlv");
    curl_setopt($ch, CURLOPT_USERAGENT, array_rand($useragent));

    //函数中加入下面这条语句

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

    // (3)执行
    $result = curl_exec($ch);
    // (4)关闭
    curl_close($ch);
    return $result;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
绕看漫画小偷程序,免费完全开源,新手可以学习用,2011.11.30更新全站程序为完全开源版,代码完全公开,适合初级学习;可以用于交流修改和二次开发;无任何加密文件,可以任意修改了;本站会陆续更新所有程序为开源免费版,支持二次开发。 目标站是:raokan 更新速度还可以,主要是图片没经过防盗链,容易被采集。 广告比较少,界面不是太漂亮,很一般的那种。 他的漫画资源倒是不少,不过有个很大的缺点与那些专门的漫画站比,就是速度不好,为什么? 因为,他的站的图片是一个ip里面的,不像其他大站,图片分为好几个服务器,会根据客户ip不同自动调整服务器ip,力求找到最优的速度服务器. 这个站是我大学时候的东西了,有几年了。。 属于古董级的东西了。大家不嫌弃的话,就下载研究研究,很简单,也许你看了代码后也完全可以仿照着写出小偷程序了呢。 代码写法经过整合,完全适合新手参考,相同代码归类,一目了然。 下面说说本程序的修改方法: 本程序无后台,修改网站信息,找到config.asp这个文件,用记事本打开,可以看到下面的代码: 这些代码没行后面都有相应的注释,按照注释进行修改就可以了。 其他的文件一般不用修改 其他文件想修改的话,要用记事本打开相应的文件。 我举个例子就成了,比如 头部文件 head.asp ,用记事本打开,看到如下: 以上这些里面的网址啥的都是可以修改的,等等吧,自己看着办了,网址和汉字都还是可以看懂的吧。。 说说广告问题: 广告都是js调用的,我这里也没仔细看过哪个是管的哪个广告,里面的js文件都可以用记事本打开看看,如果里面是广告网址的话,那么他就是广告文件了,记得js广告文件,必须代码是经过js转换后的。 Tags: 漫画小偷 4dzz小偷 asp小偷

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值