+ -
当前位置:首页 → 问答吧 → 采集过来的数据如何模拟为用户通过表单提交的数据

采集过来的数据如何模拟为用户通过表单提交的数据

时间:2011-09-16

来源:互联网

怕大家不明白解释一下:现在有一个采集网站,类似于天涯易读,通过用户提交天涯帖子的url来处理返回给用户“只看楼主”,现在我想通过火车头直接采集天涯帖子的url(已经实现),但是问题是如何将采集到的数据模拟为表单提交的数据,让处理页面识别。

作者: 臧小姐   发布时间: 2011-09-16

define('DB_CONN',true);
include('comm.php');
$title=$_POST['title'];
$url= $_POST['url'];
$time=$_POST['time'];
$db->query("set names 'utf8'");
$sql="insert into test(`title`,`url`,`time`) values('$title','$url','$time')";
echo $sql;
$db->query($sql);

作者: 臧小姐   发布时间: 2011-09-16

define('DB_CONN',true);
include('comm.php');
$url=trim($_POST['url']);
if($url=="")
   $url=trim($_GET['url']);
//$url="http://www.tianya.cn/publicforum/content/funinfo/1/2273274.shtml";
if(strpos($url,"?")!==false)
   err_deal('/','天涯地址填写有误');
if(strpos($url,"#")!==false)
   err_deal('/','天涯地址填写有误');                  
if($MAGIC_QUOTES)
{
        $url=addslashes($url);
}
$pt='@^http://[^\?]*?\.tianya\.cn@i';
if(!preg_match($pt,$url))
{
        err_deal('/','天涯地址填写有误');
}

//file_get_contents(
//stream_context_create(

$tp_row=get_artmsg($url,$db);
if($tp_row)
{
        $gourl='/art'.date('Ym',$tp_row['adate']).'_1_'.$tp_row['kid_ty'].'_'.$tp_row['id'].'.htm';
        err_deal($gourl,'帖子已经获取');
        exit();
}

上面那段代码是接收火车头采集过来的数据,本段代码是接收处理表单提交的

作者: 臧小姐   发布时间: 2011-09-16