您现在的位置是:首页 > cms教程 > 帝国CMS教程帝国CMS教程

帝国CMS百度主动提交URL和熊掌号提交的方法

怀蕊2023-05-26帝国CMS教程已有人查阅

导读帝国CMS百度主动提交URL和熊掌号修改方法,首先打开ecmsinfo.php,添加以下代码,打开listinfo.php ,添加提交按钮代码

帝国CMS百度主动提交URL和熊掌号修改方法,首先打开ecmsinfo.php,添加以下代码

elseif($enews == "Post_Baidu_sitemap") //文章实时发送百度  
{
    $id = $_POST['id'];
    $urls = $_POST['titleurl'];
    ePostBaiduSitemap($id, $urls);
}
elseif($enews == "Post_realtime") //熊掌号新增内容接口  
{
    $id = $_POST['id'];
    $urls = $_POST['titleurl'];
    ePostrealtime($id, $urls);
}
elseif($enews == "Post_batch") //熊掌号历史内容接口  
{
    $id = $_POST['id'];
    $urls = $_POST['titleurl'];
    ePostrealtime($id, $urls);
}

打开listinfo.php ,添加提交按钮代码

< input type = "submit" name = "Submit101" value = "百度URL主动提交" onClick = "document.listform.enews.value='Post_Baidu_sitemap';document.listform.action='ecmsinfo.php';" > 
< input type = "submit" name = "Submit52" value = "熊掌号新增内容" onClick = "document.listform.enews.value='Post_realtime';document.listform.action='ecmsinfo.php';" > 
< input type = "submit" name = "Submit102" value = "熊掌号历史内容" onClick = "document.listform.enews.value='Post_batch';document.listform.action='ecmsinfo.php';" >

打开userfun.php,,添加提交函数

//发送给百度时时更新-------------------------------  
function ePostBaiduSitemap($id, $_urls) {
    $site = 'https://www.pc07.com'; //你的网站域名  
    $token = 'JG43q1HpKMWiNQ3D'; //百度给的token  
    $countcount = count($id);
    if (empty($count)) {
        printerror("未选择信息ID", "", 1, 0, 1);
    }
    $urls = array();
    for ($i = 0; $i < $count; $i++) {
        $id[$i] = (int) $id[$i];
        if (array_key_exists($id[$i], $_urls)) {
            $urls[] = $_urls[$id[$i]];
        }
    }
    $api = "http://data.zz.baidu.com/urls?site=$site&token=$token";
    $ch = curl_init();
    $options = array(CURLOPT_URL = > $api, CURLOPT_POST = > true, CURLOPT_RETURNTRANSFER = > true, CURLOPT_POSTFIELDS = > implode("n", $urls), CURLOPT_HTTPHEADER = > array('Content-Type: text/plain'), );
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    $httpstat = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if ($httpstat == 200) {
        $obj = json_decode($result);
        printerror("今天剩余{$obj->remain}条,成功提交{$obj->success}条", "", 1, 0, 1);
    } else {
        printerror('推送失败', "", 1, 0, 1);
    }
}
//熊掌号新增内容接口  
function ePostrealtime($id, $_urls) {
    $site = 'https://www.pc07.com'; //你的网站域名  
    $token = 'HUuRZYgrlGLrVysh'; //在搜索资源平台申请的推送用的准入密钥  
    $appid = '1585197816243468'; //您的熊掌号唯一识别ID  
    $countcount = count($id);
    if (empty($count)) {
        printerror("未选择信息ID", "", 1, 0, 1);
    }
    $urls = array();
    for ($i = 0; $i < $count; $i++) {
        $id[$i] = (int) $id[$i];
        if (array_key_exists($id[$i], $_urls)) {
            $urls[] = $_urls[$id[$i]];
        }
    }
    $api = "http://data.zz.baidu.com/urls?appid=$appid&token=$token&type=realtime";
    $ch = curl_init();
    $options = array(CURLOPT_URL = > $api, CURLOPT_POST = > true, CURLOPT_RETURNTRANSFER = > true, CURLOPT_POSTFIELDS = > implode("n", $urls), CURLOPT_HTTPHEADER = > array('Content-Type: text/plain'), );
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    $httpstat = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if ($httpstat == 200) {
        $obj = json_decode($result);
        printerror("今天剩余{$obj->remain_realtime}条,成功提交{$obj->success_realtime}条", "", 1, 0, 1);
    } else {
        printerror('推送失败', "", 1, 0, 1);
    }
}
//熊掌号历史内容接口  
function ePostbatch($id, $_urls) {
    $site = 'https://www.pc07.com'; //你的网站域名  
    $token = 'HUuRZYgrlGLrVysh'; //在搜索资源平台申请的推送用的准入密钥  
    $appid = '1585197816243468'; //您的熊掌号唯一识别ID  
    $countcount = count($id);
    if (empty($count)) {
        printerror("未选择信息ID", "", 1, 0, 1);
    }
    $urls = array();
    for ($i = 0; $i < $count; $i++) {
        $id[$i] = (int) $id[$i];
        if (array_key_exists($id[$i], $_urls)) {
            $urls[] = $_urls[$id[$i]];
        }
    }
    $api = "http://data.zz.baidu.com/urls?appid=$appid&token=$token&type=batch";
    $ch = curl_init();
    $options = array(CURLOPT_URL = > $api, CURLOPT_POST = > true, CURLOPT_RETURNTRANSFER = > true, CURLOPT_POSTFIELDS = > implode("n", $urls), CURLOPT_HTTPHEADER = > array('Content-Type: text/plain'), );
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    $httpstat = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    if ($httpstat == 200) {
        $obj = json_decode($result);
        printerror("今天剩余{$obj->remain_batch}条,成功提交{$obj->success_batch}条", "", 1, 0, 1);
    } else {
        printerror('推送失败', "", 1, 0, 1);
    }
}

本文标签:

很赞哦! ()

相关源码

  • (PC+WAP)茶叶茶艺茶道茶文化pbootcms模网站源码下载本模板基于PbootCMS系统开发,为茶叶企业、茶艺培训机构设计,特别适合展示茶产品、茶道文化等内容。采用响应式技术,确保在不同设备上都能呈现优雅的茶文化氛围。查看源码
  • (PC+WAP)生活资讯百科新闻门户类pbootcms网站模板为生活资讯、百科门户类企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5响应式架构,PC与手机端实时数据同步,覆盖全终端用户浏览场景。查看源码
  • (PC+WAP)聚氨酯粉末涂料防腐耐用材料粘合剂网站源码下载为化工涂料企业设计的展示系统,集成产品技术参数库、颜色样板展示器和配方查询模块。支持粉末涂料、环氧树脂等多类产品分类展示查看源码
  • WordPress个人博客主题 - wp-Concise-v1.0免费下载wp-Concise-v1.0是一款专为个人博客设计的简约风格主题,采用全宽排版设计理念,注重内容呈现效果。该模板适用于个人随笔、技术分享、生活记录等博客场景,帮助用户打造专业的内容展示空间。查看源码
  • (自适应)pbootcms家政服务保洁保姆打扫卫生网站模板下载本模板基于PbootCMS内核开发,为家政服务企业量身定制。设计风格温馨亲切,突出家政行业的专业与贴心服务特性,多方位展示企业服务项目与优势。查看源码
  • (自适应响应式)家电维修清晰服务网站pbootcms模板免费下载本模板基于PbootCMS内核开发,为维修服务类企业打造,特别适合家电维修、设备维护等行业使用。通过简洁直观的界面设计,帮助企业快速搭建专业级服务平台,实现线上业务高效管理。查看源码
分享笔记 (共有 篇笔记)
验证码: