最新帝国cms主动推送插件(集所有搜索最全版)汇站网 - 汇站网

最新帝国cms主动推送插件(集所有搜索最全版)

2021-07-10 0 896
汇站网给大家分享一个帝国插件代码:
class zhanzhangPush {
    private $dbhost 'localhost:3306'// mysql 服务器主机地址
    private $dbuser ''// mysql 用户名
    private $dbpass ''// mysql 用户名密码
    private $domain ''//不带 www 的域名
    private $zhanzhangToken ''//站长 token
    private $xiongToken ''//熊掌号 token
    private $xiongAppid ''//熊掌号 appid
    private $shenmaUserName ''//神马 username
    private $shenmaToken ''//神马 token
    private $http "https"//协议请求 http  https
    private $database ''//数据库名
    private $www 'm'//域名前缀  www m
     
    public function init() {
        $this->shenma_push($urls);
        // $this->baidu_push($urls);
        // $this->real_push($urls);
        // $this->batch_push($urls);
        $this->sogouPush($urls);
    }
    /**
     * 获取网站 url 代码来源 www.zjkweiqi.cn 这家软件站
     */
    public function get_site_urls($artId$vodId$limit = 800) {
        $limit $limit / 2;
        $conn = mysqli_connect($this->dbhost$this->dbuser$this->dbpass);
        if (!$conn) {
            die('连接失败: ' . mysqli_error($conn));
        }
        //var_dump($conn);die;
        mysqli_query($conn"set names utf8");
        mysqli_select_db($conn$this->database);
  
        //var_dump($artId);die;
        //var_dump($urls);die;
        //查找电影--------------------------------------------------
        $sql "SELECT titleurl,id   FROM www_96kaifa_com_ecms_news where id > {$artId} limit $limit";
        $retval = mysqli_query($conn$sql);
        if (!$retval) {
            die('无法读取数据: ' . mysqli_error($conn));
        }
        $urls = [];
        while ($row = mysqli_fetch_assoc($retval)) {
            $artId $row['id'];
            
            array_push($urls$this->http"://m." $this->domain$row['titleurl']);
        }
        $data = ['urls' => $urls'art_id' => $artId'vod_id' => $vodId];
        return $data;
    }
    /**
     * 获取 api 接口
     */
    public function get_api($zhanzhang) {
        switch ($zhanzhang) {
            case 'shenma':
                return "http://data.zhanzhang.sm.cn/push?site=".$this->www."." $this->domain $this->shenmaUserName $this->shenmaToken;
            case 'realtime':
                return "http://data.zz.baidu.com/urls?appid=" $this->xiongAppid $this->xiongToken;
            case 'batch':
                return "http://data.zz.baidu.com/urls?appid=" $this->xiongAppid $this->xiongToken;
            case 'baidu':
                return "http://data.zz.baidu.com/urls?site=".$this->www."." $this->domain $this->zhanzhangToken;
        }
    }
    /**
     * 推送
     */
    public function push($api$urls) {
        // var_dump($urls);die;
        $ch = curl_init();
        $options array(CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
        // CURLOPT_POSTFIELDS => implode("\n", array_slice($urls,0,10)),
        CURLOPT_POSTFIELDS => implode("\n"$urls), CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),);
        curl_setopt_array($ch$options);
        $res = curl_exec($ch);
        return $res;
    }
    /**
     * 神马站长推送
     */
    public function shenma_push($urls) {
        $configData $this->get_config();
        $data $this->get_site_urls($configData['shenma']['art_id'], $configData['shenma']['vod_id']);
        $urls $data['urls'];
        $configData['shenma']['art_id'] = $data['art_id'];
        $configData['shenma']['vod_id'] = $data['vod_id'];
        //推送接口
        $api $this->get_api('shenma');
        $res $this->push($api$urls);
        $jsonres = json_decode($res);
        if ($jsonres->errorMsg == '') {
            $this->log("神马站长成功推送" count($urls) . "条");
            $this->update_config($configData);
        else {
            $this->log("神马站长推送失败:" $res);
        }
        
        var_dump($res);
    }
    /**
     * 百度站长推送
     */
    public function baidu_push($urls) {
        $configData $this->get_config();
        $data $this->get_site_urls($configData['baidu']['art_id'], $configData['baidu']['vod_id']);
        $urls $data['urls'];
        $configData['baidu']['art_id'] = $data['art_id'];
        $configData['baidu']['vod_id'] = $data['vod_id'];
        $api $this->get_api('baidu');
        $res $this->push($api$urls);
        $jsonres = json_decode($res);
        if ($jsonres->error >= 400) {
            $this->log("百度站长推送失败:" $res);
        else {
            $this->log("百度站长成功推送" $jsonres->success"条,今日还可推送:" $jsonres->remain"条");
            $this->update_config($configData);
        }
        var_dump($urls);die;
        echo ;
        var_dump($res);
    }
    /**
     * 熊掌号天级推送
     */
    public function real_push($urls) {
        $configData $this->get_config();
        $data $this->get_site_urls($configData['realtime']['art_id'], $configData['realtime']['vod_id'], 10);
        $urls $data['urls'];
        $configData['realtime']['art_id'] = $data['art_id'];
        $configData['realtime']['vod_id'] = $data['vod_id'];
        $api $this->get_api('realtime');
        $res $this->push($api$urls);
        $jsonres = json_decode($res);
        if ($jsonres->error >= 400) {
            $this->log("熊掌号天级推送失败:" $res);
        else {
            $this->log("熊掌号天级成功推送" $jsonres->success"条,今日还可推送:" $jsonres->remain"条");
            $this->update_config($configData);
        }
        // var_dump($urls);die;
        echo ;
        var_dump($res);
    }
    /**
     * 熊掌号周级推送
     */
    public function batch_push($urls) {
        $configData $this->get_config();
        $data $this->get_site_urls($configData['batch']['art_id'], $configData['batch']['vod_id']);
        $urls $data['urls'];
        $configData['batch']['art_id'] = $data['art_id'];
        $configData['batch']['vod_id'] = $data['vod_id'];
        $api $this->get_api('batch');
        $res $this->push($apiarray_slice($urls, 0, 1));
        $jsonres = json_decode($res);
        if ($jsonres->error >= 400) {
            $this->log("熊掌号周级推送失败:" $res);
        else {
            $this->log("熊掌号周级成功推送" $jsonres->success"条,今日还可推送:" $jsonres->remain"条");
            $this->update_config($configData);
        }
        // var_dump($urls);die;
        echo ;
        var_dump($res);
    }
    /**
     *搜狗推送
     */
    public function sogouPush($urls) {
        $configData $this->get_config();
        $data $this->get_site_urls($configData['sougou']['art_id'], $configData['sougou']['vod_id'], 10);
        $urls $data['urls'];
        $configData['sougou']['art_id'] = $data['art_id'];
        $configData['sougou']['vod_id'] = $data['vod_id'];
        echo ();
        // var_dump($data);die;
        for ($i = 0;$i count($urls);$i++) {
            $postUrl 'http://fankui.help.sogou.com/index.php/web/web/addShoulu';
            $postData array("source" => "1""site_type" => "1""Shoulu" => array("webAdr" => $urls[$i], "email" => "103@qq.com""reason" => ""));
            $postData = http_build_query($postData);
            $curl = curl_init();
            curl_setopt($curl, CURLOPT_URL$postUrl);
            curl_setopt($curl, CURLOPT_USERAGENT'Opera/9.80 (Windows NT 6.2; Win64; x64) Presto/2.12.388 Version/12.15');
            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_HTTPHEADERarray('Content-Type: application/x-www-form-urlencoded'));
            curl_setopt($curl, CURLOPT_POSTFIELDS$postData);
            curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
            $res = curl_exec($curl);
            curl_close($curl);
            $jsonres = json_decode($res);
            if ($jsonres->success == 'true') {
                $this->log("搜狗推送成功:" $urls[$i]);
            else {
                $this->log("搜狗推送失败:" $urls[$i]);
            }
        }
        $this->update_config($configData);
    }
    /**
     * 获取配置信息
     */
    public function get_config() {
        $configPath 'push_config.txt';
        if (file_exists($configPath)) {
            $data file_get_contents($configPath);
            return unserialize($data);
        else {
            $myfile fopen($configPath"w");
             $configData = [
                'shenma' => [
                    'art_id' => 0,
                    'vod_id' => 0
                    ],
                'baidu' => [
                    'art_id' => 0,
                    'vod_id' => 0
                    ],
                'realtime' => [
                    'art_id' => 0,
                    'vod_id' => 0
                    ],
                'batch' => [
                    'art_id' => 0,
                    'vod_id' => 0
                    ],
                'sougou' => [
                    'art_id' => 0,
                    'vod_id' => 0
                    ],
                ];
            fwrite($myfile, serialize($configData));
            fclose($myfile);
            return $configData;
        }
    }
    /**
     * 修改配置信息
     */
    public function update_config($configData) {
        $configPath 'push_config.txt';
        $myfile fopen($configPath"w");
        fwrite($myfile, serialize($configData));
        fclose($myfile);
    }
    public function log($data) {
        file_put_contents('zhanzhang_push.log'date('Y-m-d H:i:s') . " " $data . PHP_EOL, FILE_APPEND);
    }
}
收藏 (0)

微信扫一扫

支付宝扫一扫

点赞 (0)

免责 声明

本资源仅用于个人 学习和研究使用,禁止用于任何商业环境!

 1.  本网站名称:汇站网
 2.  本站永久网址:https://www.huizhanii.com/
 3.  本站所有资源来源于网友投稿和高价 购买,所有资源仅对编程人员及源代码爱好者开放下载做参考和研究及学习,本站不提供任何技术服务 !
 4.  本站所有资源的展示图片和信息不代表本站的立场 !本站只是储蓄平台及搬运
 5.  下载者禁止在服务器和虚拟机下进行搭建运营,本站 所有资源不支持联网运行!只允许调试,参考和研究!!!!
 6.  未经原版权作者许可,禁止用于任何 商业环境,任何人不得擅作它用,下载者不得用于违反国家法律,否则发生的一切法律后果自行承担!
 7.  为尊重作者版权,请在下载24小时 内删除!请购买原版授权作品,支持你喜欢的作者,谢谢!
 8.  若资源侵犯了您的合法权益, 请持 您的版权证书和相关原作品信息来信通知我们请来信     通知我们 我们会及时删除,给您带来的不便,我们深表歉意!
 9.  如下载链接失效、广告或者压缩包 问题请联系站长处理!
 10.  如果你也有好源码或者教程,可以 发布到网站,分享有金币奖励和额外收入!
 11.  本站资源售价只是赞助,收取费用 仅维持本站的日常运营所需!
 12.  因源码具有可复制性,一经赞助 ,不得以任何形式退款。
 13.  更多详情请点击查看

汇站网 其他插件 最新帝国cms主动推送插件(集所有搜索最全版) https://www.huizhanii.com/12480.html

汇站

站长资源下载中心-找源码上汇站

上一篇:

已经没有上一篇了!

常见问题
  • 如果付款后没有弹出下载页面,多刷新几下,有问题联系客服!
查看详情
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
  随机评论   表情   下载本站到电脑桌面


表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情 表情
登录后评论
联系官方客服

为您解决烦忧 - 24小时在线 专业服务

(汇站网)一个专注站长资源的平台网站,提供最新的网站模板和整站源码,内容包含各类精品网页模板,企业网站模板,网站模板,DIV+CSS模板,织梦模板,帝国cms模板,discuz模板,wordpress模板,个人博客论坛模板,上千种免费网页模板下载尽在汇站网.找源码上汇站.huizhanii.com