科学刀自动签到,自动答题PHP源码

科学刀自动签到+自动答题

配合宝塔计划任务(每天定时访问)

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

48)19){RYRI1UU4@2C)ATFE.png

PHP代码

<?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,0);
  //获取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,0);
  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);



  文件名称:

  文件大小:

  下載声明:本站网络资源来自网络收集或本人原创,转载请注明出处!若资源侵犯了你的版权,请联系博主,我们会在24小时内删除侵权资源!

立即下载

打赏

作者:独醉复制或转载请以超链接形式注明转自 独醉博客
原文名称:科学刀自动签到,自动答题PHP源码
原文地址:http://blog.dzzui.com/160.html

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)