hqking 发表于 2007-11-19 22:46:26

[原创]火车头采集器3.2数据库发布的代替方案

[原创]火车头采集器3.2数据库发布的代替方案                                                                                                                                                   一、没有了就用在线发布功能吧,自己写个没有任何验证的提交页面.跟直接入库一样快(这个是看别人的,我没实验过,怀疑...)
二、火车头的直接入库方案(原创)
1、access2mysql
2、用php程序生成insert 语句 for dede或dicuz的相关表(包含标题,内容,作者等)
3、直接用数据库导入。

使用要求是:熟悉相关cms或bbs程序的相关表,这个可以用phpadmin查看字段。
有兴趣的想偷懒的还可以自己用delphi或c++等语言写个客户端来做。嘿嘿

以dedecms为例子:
先把 暗藏常常access数据库倒入到mysql中,修改字段'标题'为title,字段'内容'为 content.

dedetitle.sql.php//获得倒入 dedecms的 sql语句

<?php
$thisHOST="localhost";
$thisDBadmin="root";
$thisDBpasswd="root";
$thisDB="caiji";

static $id;
$typeid=1;//栏目号
$typeid2=0;//表示是文章类型


mysql_connect ("$thisHOST", "$thisDBadmin","$thisDBpasswd");
mysql_select_db ("$thisDB");
$sql = "SELECT `title` , `body` FROM `content` ";

$result = mysql_query ($sql);


if ($row = mysql_fetch_array($result))
{
          echo "insertinto `dede_archives`(`ID`,`typeid`,`typeid2`,`title`) values";
   echo "<br>";
   $id=1;
do {
      
$title=$row;
$title=str_replace("'", "''", $title);


echo "($id,$typeid,$typeid2,'$title'),<br>";
$id++;

}while($row = mysql_fetch_array($result));

}

?>


dedebody.sql.php//获得倒入 dedecms的 sql语句
<?php
$thisHOST="localhost";
$thisDBadmin="root";
$thisDBpasswd="root";
$thisDB="caiji";

static $id;
$typeid=1;//栏目号
$typeid2=0;//表示是文章类型

mysql_connect ("$thisHOST", "$thisDBadmin","$thisDBpasswd");
mysql_select_db ("$thisDB");
$sql = "SELECT `body` FROM `content` ";

$result = mysql_query ($sql);
if ($row = mysql_fetch_array($result))
{
         $id=1;
          echo "insertinto `dede_addonarticle`(`aid`,`typeid`,`body`) values";
   echo "<br>";

do {
      
      $body=$row;
$body=str_replace("'", "''", $body);
echo "($id,$typeid,'$body'),<br>";
$id++;

}while($row = mysql_fetch_array($result));

}

?>

senddata我没加,用的时候自己加上吧,不然显示1969年的日期

有空去我的站看看.
http://www.pochanzhe.com/bbs/index.php
引用:本帖

欢迎大家到我的站做客
破而立中文立志网
讨论如何赚钱。包括网络赚钱

[ 本帖最后由 hqking 于 2007-11-22 20:44 编辑 ]

xyyfx 发表于 2007-11-19 23:42:50

很久以前就可以哇,自己写接口也可以。

孤魂 发表于 2007-11-20 01:45:41

ad贴,鉴定完毕
页: [1]
查看完整版本: [原创]火车头采集器3.2数据库发布的代替方案