如何通过抓取PHP版本获取迅雷VIP账号的详细方法?
- 内容介绍
- 文章标签
- 相关推荐
本文共计297个文字,预计阅读时间需要2分钟。
看了@Jinn_WeiPython版本的抓取账号,顺手动写了PHP版本+PS1:代码未经优化,只实现了基本功能+PS2:代码中使用了Snoopy+PS3:测试地址:http://xunlei.kphcdr.com http://www.oschina.net/code/s
PS1:代码没经过优化,只实现了基本的功能
PS2:代码中使用了Snoopy
PS3:测试地址:xunlei.kphcdr.com
www.oschina.net/code/snippet_141743_48612
1.[代码][PHP]代码
<?php /** * 抓取爱密码迅雷VIP账号 * @author kphcdr@163.com */ header("Content-type: text/html; charset=UTF-8"); include 'Snoopy.php'; $url = 'www.521xunlei.com/forum-xunleihuiyuan-1.html'; //找出匹配的网址 $snoopy = new Snoopy(); $result = $snoopy->fetchlinks($url)->getResults(); foreach($result as $key=>$val) { if(FALSE === strpos($val, 'thread-')) { unset($result[$key]); } else { if(!strpos($val, '-1-1.html')) { unset($result[$key]); } } } $real = new Snoopy(); $result = array_values(array_unique($result)); $text = $real->fetchtext($result[1])->getResults(); $text = iconv('gbk','UTF-8//IGNORE',$text); //匹配出需要的内容 $pattern = '/^迅雷会员账号|迅雷共享账号+[a-zA-Z0-9_]{4,15}+:+[0-9]+爱密码分享密码+[a-zA-Z0-9_]{4,20}\s/'; preg_match_all($pattern,$text,$return); foreach($return[0] as $a) { echo $a; echo '<br />'; }
2.[文件] Snoopy.php~39KB 下载(126)
本文共计297个文字,预计阅读时间需要2分钟。
看了@Jinn_WeiPython版本的抓取账号,顺手动写了PHP版本+PS1:代码未经优化,只实现了基本功能+PS2:代码中使用了Snoopy+PS3:测试地址:http://xunlei.kphcdr.com http://www.oschina.net/code/s
PS1:代码没经过优化,只实现了基本的功能
PS2:代码中使用了Snoopy
PS3:测试地址:xunlei.kphcdr.com
www.oschina.net/code/snippet_141743_48612
1.[代码][PHP]代码
<?php /** * 抓取爱密码迅雷VIP账号 * @author kphcdr@163.com */ header("Content-type: text/html; charset=UTF-8"); include 'Snoopy.php'; $url = 'www.521xunlei.com/forum-xunleihuiyuan-1.html'; //找出匹配的网址 $snoopy = new Snoopy(); $result = $snoopy->fetchlinks($url)->getResults(); foreach($result as $key=>$val) { if(FALSE === strpos($val, 'thread-')) { unset($result[$key]); } else { if(!strpos($val, '-1-1.html')) { unset($result[$key]); } } } $real = new Snoopy(); $result = array_values(array_unique($result)); $text = $real->fetchtext($result[1])->getResults(); $text = iconv('gbk','UTF-8//IGNORE',$text); //匹配出需要的内容 $pattern = '/^迅雷会员账号|迅雷共享账号+[a-zA-Z0-9_]{4,15}+:+[0-9]+爱密码分享密码+[a-zA-Z0-9_]{4,20}\s/'; preg_match_all($pattern,$text,$return); foreach($return[0] as $a) { echo $a; echo '<br />'; }

