<?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];//内容