帝国cms利用PHP直接提交数据更新文章/帝国cms火车头采集器接口文件。闲着没事把火车头模块给仔细研究了一下,结合帝国cms,于是有了下面的代码,会php的大佬可以修改,下面的只是一个简单的提交代码,数据需要自己设置!
- <?php
- $url = "https://www.meiweny.cn/e/admin/123.php"; // 替换为实际的接收数据的URL,你的火车头接口
-
- $postData = array(
- "enews" => "AddNews",
- "classid" => "1",
- "bclassid" => "0",
- "id" => "0",
- "filepass" => "[Timestamp:时间]",
- "username" => "admin1",
- "oldfilename" => "",
- "oldgroupid" => "",
- "oldchecked" => "1",
- "newstext_url" => "",
- "ecmsfrom" => "",
- "ecmsnfrom" => "1",
- "fstb" => "",
- "oldttid" => "",
- "ecmscheck" => "0",
- "ztids" => "",
- "zcids" => "",
- "oldztids" => "",
- "oldzcids" => "",
- "havetmpic" => "0",
- "title" => "",
- "titlecolor" => "",
- "ftitle" => "",
- "checked" => "1",
- "isgood" => "0",
- "firsttitle" => "0",
- "keyboard" => "",
- "titleurl" => "",
- "newstime" => "2023-11-22 17:56:36",
- "titlepic" => "",
- "smalltext" => "",
- "writer" => "",
- "w_id" => "",
- "befrom" => "",
- "befrom_id" => "选择信息来源",
- "newstext" => "",
- "dokey" => "1",
- "qz_url" => "",
- "autosize" => "5000",
- "getfirsttitlepic" => "",
- "getfirsttitlespicw" => "105",
- "getfirsttitlespich" => "118",
- "istop" => "0",
- "newstempid" => "1",
- "groupid" => "0",
- "userfen" => "0",
- "onclick" => "62",
- "totaldown" => "0",
- "newspath" => "",
- "filename" => "",
- "infotags" => "",
- "oldinfotags" => "",
- "info_diyotherlink" => "0",
- "info_keyid" => "",
- "info_infouptime" => "2023-11-22 17:56:36",
- "info_infodowntime" => "",
- "vote_title" => "",
- "vote_name" => ["", "", "", "", "", "", "", ""],
- "vote_num" => ["0", "0", "0", "0", "0", "0", "0", "0"],
- "v_vote_num" => "1",
- "v_editnum" => "8",
- "vote_class" => "0",
- "dovote_ip" => "0",
- "vote_olddotime" => "0000-00-00",
- "vote_dotime" => "0000-00-00",
- "vote_width" => "500",
- "vote_height" => "300",
- "vote_tempid" => "1",
- "addnews" => "提交"
- );
-
- $postDataStr = http_build_query($postData);
-
- $ch = curl_init();
-
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postDataStr);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
- $response = curl_exec($ch);
-
- if ($response === false) {
- echo "CURL Error: " . curl_error($ch);
- } else {
- echo "Response: " . $response;
- }
-
- curl_close($ch);
- ?>
这个就是火车头对接帝国cms免登陆发布的php文件,上传到你的admin目录下面就行,例如:e/admin/
- <?php
-
- $password='9999999';
- if($password!=$_GET['pw']) exit('验证密码错误');
-
- define('EmpireCMSAdmin','1');
- require("../class/connect.php");
- require("../class/db_sql.php");
- require("../class/functions.php");
- require LoadLang("pub/fun.php");
- require("../class/delpath.php");
- require("../class/copypath.php");
- require("../class/t_functions.php");
- require("../data/dbcache/class.php");
- require("../data/dbcache/MemberLevel.php");
-
- foreach($class_r as $kv)
- {
- if($kv['modid']=='1')
- {
- $cates[]=array('cname'=>$kv['classname'],'cid'=>$kv['classid'],'pid'=>$kv['bclassid']);
- }
- }
- if(empty($_POST))
- {
-
- echo "<select name='list'>";
- echo maketree($cates,0,'');
- echo '</select>';
- exit();
- }
- foreach($_POST as $k=>$v){
- if(strpos($v,'[db:') !== false){
- $_POST[$k] = '';
- }
- }
- $link=db_connect();
- $empire=new mysqlquery();
-
- $loginin=$_POST['username'];
- $lur=$empire->fetch1("select * from {$dbtbpre}enewsuser limit 1");
- if(!$lur) exit('不存在的用户名'.$loginin);
- $loginin = $lur['username'];
- $logininid=$lur['userid'];
- $loginrnd=$lur['rnd'];
- $loginlevel=$lur['groupid'];
- $loginadminstyleid=$lur['adminstyleid'];
- $incftp=0;
- if($public_r['phpmode'])
- {
- include("../class/ftp.php");
- $incftp=1;
- }
- require("../class/hinfofun.php");
- $navtheid=(int)$_POST['filepass'];
- AddNews($_POST,$logininid,$loginin);
- db_close();
- $empire=null;
-
- function maketree($ar,$id,$pre)
- {
- $ids='';
- foreach($ar as $k=>$v){
- $pid=$v['pid'];
- $cname=$v['cname'];
- $cid=$v['cid'];
- if($pid==$id)
- {
- $ids.="<option value='$cid'>{$pre}{$cname}</option>";
- foreach($ar as $kk=>$vv)
- {
- $pp=$vv['pid'];
- if($pp==$cid)
- {
- $ids.=maketree($ar,$cid,$pre." ");
- break;
- }
- }
- }
- }
- return $ids;
- }