惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
V
Visual Studio Blog
P
Privacy International News Feed
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
Webroot Blog
Webroot Blog
T
Threatpost
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
小众软件
小众软件
L
LINUX DO - 最新话题
C
Cisco Blogs
T
Troy Hunt's Blog
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
www.infosecurity-magazine.com
www.infosecurity-magazine.com
雷峰网
雷峰网
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Know Your Adversary
Know Your Adversary
博客园 - 叶小钗
罗磊的独立博客
V
V2EX
博客园 - Franky
P
Proofpoint News Feed
SecWiki News
SecWiki News
腾讯CDC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
Cisco Talos Blog
Cisco Talos Blog
N
News and Events Feed by Topic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

龙辉's Blog - php

贵州师范大学抢课脚本-正方教务系统V8.0.0 - 龙辉's Blog 简单实现每日健康自动打卡 - 龙辉's Blog php获取客户端ip以及ip伪造 - 龙辉's Blog XSS经典漏洞复现-手撕某非法获取个人信息网站 - 龙辉's Blog php7.2中each()函数被弃用的替换办法 - 龙辉's Blog 云签网站问题反馈贴 - 龙辉's Blog 给网站接入QQ登录,无需申请QQ互联 - 龙辉's Blog ezsql-超级好用的操作类 - 龙辉's Blog php对称加密 - 龙辉's Blog
贴吧关注类-php - 龙辉's Blog
博主: Tinker-站长 · 2020-11-03 · via 龙辉's Blog - php
  • 发布时间:
  • 7995 次浏览
  • 3 条评论
  • 122字数
  • 分类: php
  1. 首页
  2. 正文  
  3. 分享到:

有人需要用很多个号来关注贴吧,或者一个号关注多个贴吧,很明显手工是很累的.所以写了一个php关注类,开源出来给大家.
因为大量的关注需要消耗服务器的资源,所以你也可以在我的网站使用
使用地址:http://tieba.eirds.cn/
    <?php
    
    /**
    *author : 一千零一夜-龙辉QQ1790716272
    *date:2020/03/28
    *description:贴吧关注类
    *parma: kw=需要关注的吧  bduss=登录贴吧之后的bduss
    *
    *
    */
    
    class tbkw{
            protected $kw = '';
            protected $bduss = '';
            protected $head = array(
                'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Accept-Encoding: gzip, deflate, br',
    'Accept-Language: zh-CN,zh;q=0.9',
    'Cache-Control: max-age=0',
    'Connection: keep-alive',
        'Host: tieba.baidu.com',
    'Sec-Fetch-Dest: document',
    'Sec-Fetch-Mode: navigate',
    'Sec-Fetch-Site: none',
    'Sec-Fetch-User: ?1',
    'Upgrade-Insecure-Requests: 1',
    'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36',
                );
        public function __construct($kw=null,$bduss=null){
            
            $this->kw = urlencode($kw);
            $this->bduss =$bduss;
            
        }
        public function like(){
    $kwurl = 'https://tieba.baidu.com/mo/q/favolike?fid='.$this->fid().'&kw='.$this->kw.'&itb_tbs='.$this->tbs().'&uid='.$this->tbs();
    //$kwurl = 'https://tieba.baidu.com/mo/q/favolike?fid=16386&kw=%E6%81%8B%E7%88%B1&itb_tbs='.$this->tbs().'&uid='.$this->tbs();
      $result = $this->geturl($kwurl,$this->bduss,$this->head);
      $results = json_decode($result,true);
      
      if($results['no']==0){
          
          $data = '关注'.urldecode($this->kw).'吧成功';
          
      }elseif($results['no']==20001){
           $data = '参数不全';
           
      }else{
          
          $data = '出现了未知的错误';
      }
      return $data;
    
        }
        
        protected function fid(){
        
            $tbinfo = json_decode($this->geturl('http://tieba.baidu.com/f/commit/share/fnameShareApi?ie=utf-8&fname='.$this->kw),true);
            $fid = $tbinfo['data']['fid'];
            return $fid ;
        }
        protected function tbs(){
            $tbs = json_decode($this->geturl('http://tieba.baidu.com/dc/common/tbs',$this->bduss),true);
            
            return $tbs['tbs'];
        }
        
        protected function geturl($url,$bduss=null,$head=null){
                $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_HEADER, 0);            
            if(!is_null($bduss))curl_setopt($ch, CURLOPT_COOKIE , 'BDUSS='.$bduss);        
            if(!is_null($head))curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);        // 对认证证书来源的检查
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);        // 使用自动跳转
            curl_setopt($ch, CURLOPT_AUTOREFERER, 1);           // 自动设置Referer
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);        // 设置等待时间
            curl_setopt($ch, CURLOPT_TIMEOUT, 1);              // 设置cURL允许执行的最长秒数
            $res = curl_exec($ch);
            curl_close($ch);
            return $res;
            }
    }    
    if($_GET['kw'] && $_GET['bduss']){
    $tbkw = new tbkw($_GET['kw'],$_GET['bduss']);
    
    print_r($tbkw->like());
    }elseif($_GET[‘bduss’]){
        $tbkw = new tbkw('云签到',$_GET['bduss']);
    
    print_r($tbkw->like());
    }
    /*代码编写完毕!就是如此简单——.——*/
?>


版权属于:龙辉博客

本文链接:https://blog.eirds.cn/317.html

如果没有特别声明则为本博原创。转载时须注明出处及本声明!

赞赏作者

如果觉得我的文章对你有用,请随意赞赏

贴吧关注类-php