科学刀自动签到+自动答题PHP版本

科学刀自动签到+自动答题自用版分享一下,可以实现科学刀每日自动签到+自动答题,可以用来赚取刀币。

图片[1]-科学刀自动签到+自动答题PHP版本-云言博客

使用教程:

1、下载程序源码,保存成xxx.php文件,然后上传到服务器或者是虚拟主机。

2、设置源码第五行$cookie = '你的cookie'; 你的cookie为你自己的cookie即可。

3、找一个网址监控网站,设置每天x点自动执行即可,每天只需执行一次即可。

推荐:

免费虚拟主机:leshuyun.com

免费监控站:cron.itdata.icu

代码分享:

<?php
    header('Access-Control-Allow-Origin:*');
    header('Content-type:application/json; charset=utf-8');
    error_reporting(0);
    $cookie = '你的cookie';
  function get($url,$cookie,$post){
      $ch = curl_init();
      $header = [
        "Cookie: $cookie"
      ];
      curl_setopt($ch, CURLOPT_URL, $url);
          if ($post) {
              curl_setopt($ch, CURLOPT_POST, 1);
              curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
          }
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_ENCODING, "");
      curl_setopt($ch, CURLOPT_REFERER, $url);
      curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
      curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36");
      curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
      $content = curl_exec($ch);
      curl_close($ch);
      return $content;
    }
    $site= get("https://www.kxdao.net/home.php?mod=space",$cookie);
    //获取formhash
    function formhash($site){
       preg_match('/formhash=(.*)" onclick/',$site,$qiandao);
       return $qiandao[1];
      }
          $formhash = formhash($site);
      $qian = get("https://www.kxdao.net/plugin.php?id=dsu_amupper&ppersubmit=true&formhash=".formhash($site),$cookie);
      preg_match('/<p>(.*)\<\/p>/',$qian,$msg);
          //开始答题 plugin.php?id=ahome_dayquestion:pop
          //循环答题
          for($num = 0; $num < 4;$num++){
                  sleep(1);
                  $data = array('formhash'=>$formhash);
                  if($num==1 || $num == 3){
                          $data['answer'] = '1';
                          $data['submit'] = 'true';
                  }elseif($num==2){
                    $data['next'] = 'true';
                  }else{
                          $data['finish'] = 'true';
                  }
                  $answerTaskUrl = 'https://www.kxdao.net/plugin.php?id=ahome_dayquestion:pop';
                  $taks = get($answerTaskUrl,$cookie,$data);
          }
    //获取信息
    function info($site,$signMsg,$taks){
        preg_match('/title="访问我的空间">(.*)<\/a>/',$site,$id);
        preg_match('/class="showmenu">(.*)<\/a>/',$site,$jifen);
        preg_match('/fastpost(.*)\';/',$site,$uid);
        if (!empty($id)) {
          $res = array('code'=>"success",'id'=>$id[1],'uid'=>$uid[1],'积分'=>$jifen[1],'signMsg'=>$signMsg);
        }else{
          $res = array('code'=>"Cookie error");
        }
                if(strpos($taks,'您今天已经参加过答题')){
                                $res['answerMsg'] = '已答题';
                }else{
                                 $res['answerMsg'] = '答题失败';
                }
        echo json_encode($res,JSON_UNESCAPED_UNICODE);
                //php 发起请求
                $time ='运行时间:'.date("Y-m-d").' '.date("h-i-sa");
                $qqurl="https://push.xuthus.cc/group/";
                $content = "用户名:{$res['id']} \n签到信息:{$res['signMsg']} \n答题信息:{$res['answerMsg']} \n {$time}";
                $length = strlen($content);
                $options = array(
                'http' => array(
                'method' => 'POST',
                'header' =>
                "Content-type: application/json; charset=utf-8" .
                "Content-length: $length",
                'content' => $content
                )
                );
                $EEE = file_get_contents($qqurl, false, stream_context_create($options));
      }

      info($site,$msg[1],$taks);

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!评论后一分钟后可见哦~~~
提交
头像

昵称

取消
昵称表情

    暂无评论内容