已掉线,重新登录

首页 > 绿虎论坛 > 杂类 > 超级灌水 (发帖)

标题: 4万余篇笑话采集源码

作者: @Ta

时间: 2014-12-30

点击: 1266

<?php
function curl($url)
{
$ch=curl_init();
//初始化curl
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//输出到屏幕上  
curl_setopt($ch,CURLOPT_URL,$url);
//提交到url
	$curl = curl_exec($ch);
	curl_close($ch);
	return $curl;
}
function curl_post($url,$post)
{
//自定义POST提交
$ch=curl_init();
//初始化curl
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//输出到屏幕上  
curl_setopt($ch,CURLOPT_POST,1);
//post提交方式
curl_setopt($ch,CURLOPT_URL,$url);
//提交到url
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
//提交post内容
	$curl_post = curl_exec($ch);
	curl_close($ch);
	return $curl_post;
}
$x=rand(0,4444);
$aid=rand(1,27); $bid=$x; 
$url="http://wule8.com/joke/view.asp?SortID={$aid}&ID={$bid}";
$abc=file_get_contents($url);
//echo $url;
$a=explode('<div class="sysad">',$abc);
$a=explode('点击链接自动发送笑话',$a[1]);
 $a=str_replace('</div><div class="txt">','',$a[0]); 
 $a=str_replace('</div><div class="txt"><a href=','',$a); 
 $a=str_replace('
','',$a); 
$a=str_replace("</div><div class='line2'><a href='sms:1?body" ,'',$a); 
$a=explode('=',$a);
$a=str_replace("】","】T_T",$a[0]);
$d=explode('T_T',$a);
$t=explode('篇',$abc);
$ty=explode('【',$t[0]);
$tyyy=explode('>',$ty[3]);
echo $type=$tyyy[1];//类型
echo $title=$d[0];//标题
echo $msg=$d[1];//内容

[隐藏样式|查看源码]


『回复列表(4|隐藏机器人聊天)』

1. ?????
(/@Ta/2014-12-30 21:27//)

2. 我发现你写的采集类代码从来不用正则,用那么多explode看起来都晕
(/@Ta/2014-12-30 22:43//)

3. @灰色头像-3GHH点CN,楼主尝试一下正则,你会爱上它的
(/@Ta/2014-12-30 23:42//)

4. @vanwoos,哦哦,好
(/@Ta/2014-12-31 12:07//)

回复需要登录

8月14日 21:15 星期四

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1