火车头采集数据导入供求模块
从数据库直接导入的哦。。不是直接入库的
GBK测试通过。。UTF8没测试哦
/*
[Destoon B2B System] Copyright (c) 2009 Destoon.COM
This is NOT a freeware, use is subject to license.txt
*/
define('DT_NONUSER', true);
$moduleid = 5;
require 'common.inc.php';
require DT_ROOT.'/include/db_access.class.php';
require DT_ROOT.'/include/module.func.php';
require DT_ROOT.'/include/post.func.php';
require DT_ROOT.'/module/'.$module.'/'.$module.'.class.php';
$CATEGORY = cache_read('category-'.$moduleid.'.php');
$AREA = cache_read('area.php');
$table = $DT_PRE.$module;
$table_data = $DT_PRE.$module.'_data';
$do = new $module($moduleid);
$ac = new db_access;
$ac->connect(DT_ROOT.'/beng.mdb', '', '', 'Content');
$result = $ac->query("SELECT * FROM Content");
while($ar = $ac->fetch_array($result)) {
$post = array();
$post['title'] = $ar['产品标题'];
$post['tag'] = $ar['产品标题'];
$post['thumb'] = $ar['产品图片'];
$post['username'] = $ar['会员'];
$post['content'] = $ar['产品名称'];
$post['status'] = 3;
$post['totime'] = '2010-01-01';//我的时间没采集,,直接用的固定的格式
$post['catid'] = 1457;//这个是栏目分类
//建立对应关系
$post = daddslashes($post);
if($do->pass($post)) {
$do->add($post);
echo $ar['产品标题'].':发布成功
';
} else {
echo $ar['产品标题'].':'.$do->errmsg.'
';
}
}
?>