本帖最后由 SVIP9大会员 于 2024-10-22 18:29 编辑
前言:
第九届全国学生宪法小卫士登录地址如下:
登录地址:https://static.qspfw.moe.gov.cn/user/#/user/login?backUrl=http%3A%2F%2Fstatic.qspfw.moe.gov.cn%2Fxf2024%2Flearn_practice_list.html
视频演示地址:https://www.bilibili.com/video/BV1TKyHYsEZx/
进入正题:
- 其实分析过程没什么难的,就是完成每一个板块,系统会发一个请求,然后完成前两个板块后才能答题~{:1_896:}
- 代码文件为1个,这1个放在一个服务器目录就行。
- 1.index.php
- 使用方法首先去上方网址登录你的账号密码,成功进入后
- F12控制台的应用----找到cookie-----找到SESSION这一栏----复制这一栏(如下图)实在不会看上方视频!!!
然后去网址复制这个token然后点击提交就行了,演示网站我就不放了,避免侵权~~~
不是不给大家搭建,我服务器害怕被各位大佬D,我就不放了! 上代码! 下方为index.php [Asm] 纯文本查看 复制代码 <!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>无限进步~</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
width: 100%;
max-width: 400px;
}
h1 {
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
label {
margin-bottom: 10px;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.status {
margin-top: 20px;
font-size: 18px;
color: green;
}
</style>
</head>
<body>
<div class="container">
<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$access_token = $_POST['access_token'];
function sendCurlRequest($url, $headers) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
return $response;
}
// 第一个请求
$url1 = 'https://api.qspfw.moe.gov.cn/examApi/practice/studyByColumnId?columnId=357&taskId=25';
$headers1 = [
'Pragma: no-cache',
'access-token: ' . $access_token,
'sourceId: 2',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36'
];
$response1 = sendCurlRequest($url1, $headers1);
// 第二个请求
$url2 = 'https://api.qspfw.moe.gov.cn/examApi/practice/practice?columnId=357&taskId=25';
$headers2 = [
'Pragma: no-cache',
'access-token: ' . $access_token,
'sourceId: 3',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded'
];
$response2 = sendCurlRequest($url2, $headers2);
echo "<div class='status'>第一板块已完成</div>";
// 第三个请求
$url3 = 'https://api.qspfw.moe.gov.cn/examApi/practice/studyByColumnId?columnId=358&taskId=25';
$headers3 = [
'Pragma: no-cache',
'access-token: ' . $access_token,
'sourceId: 2',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36'
];
$response3 = sendCurlRequest($url3, $headers3);
// 第四个请求
$url4 = 'https://api.qspfw.moe.gov.cn/examApi/practice/practice?columnId=358&taskId=25';
$headers4 = [
'Pragma: no-cache',
'access-token: ' . $access_token,
'sourceId: 3',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded'
];
$response4 = sendCurlRequest($url4, $headers4);
echo "<div class='status'>第二板块已完成</div>";
// 第五个请求
$url5 = 'https://api.qspfw.moe.gov.cn/examApi/paper/getPaper?taskId=25';
$headers5 = [
'Pragma: no-cache',
'access-token: ' . $access_token,
'sourceId: 3',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded'
];
$response5 = sendCurlRequest($url5, $headers5);
// 解析第五个请求的响应,提取 resultId
$data5 = json_decode($response5, true);
$resultId = $data5['data']['resultId'];
// 第六个请求
$url6 = 'https://api.qspfw.moe.gov.cn/examApi/paper/saveResult?taskId=25&paperId=2998&resultId=' . $resultId . '&answers=5876_D@!@5872_A@!@5874_C@!@5875_D@!@5873_D@!@5966_D@!@5963_D@!@5965_D@!@5962_D@!@5964_C@!@&takeTime=64';
$headers6 = [
'Pragma: no-cache',
'access-token: ' . $access_token,
'sourceId: 3',
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
'Content-Type: application/x-www-form-urlencoded'
];
$response6 = sendCurlRequest($url6, $headers6);
echo "<div class='status'>当前正确答案已提交!</div>";
} else {
?>
<h1>无限进步~</h1>
<form method="post" action="">
<label for="access_token">Access Token:</label>
<input type="text" id="access_token" name="access_token" required>
<button type="submit">提交</button>
</form>
<?php
}
?>
</div>
</body>
</html>
|