From eec0dc4749af7166badd2a2387f76deaea13177b Mon Sep 17 00:00:00 2001 From: admin <3364509428@qq.com> Date: Fri, 17 Oct 2025 23:27:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20More?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- More/Get.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ More/Get.php.bak | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ More/jwt.txt | 1 + More/t.php | 16 ++++++++++++++++ More/t.php.bak | 16 ++++++++++++++++ 5 files changed, 133 insertions(+) create mode 100644 More/Get.php create mode 100644 More/Get.php.bak create mode 100644 More/jwt.txt create mode 100644 More/t.php create mode 100644 More/t.php.bak diff --git a/More/Get.php b/More/Get.php new file mode 100644 index 0000000..5bda91d --- /dev/null +++ b/More/Get.php @@ -0,0 +1,50 @@ + '19884551721', + 'password' => 'LX5bH76SJf9E' +]; + +// 初始化cURL +$ch = curl_init($url); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回响应内容而不直接输出 +curl_setopt($ch, CURLOPT_POST, true); // 使用POST方法 +curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json' // 设置JSON头 +]); +curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); // JSON编码数据 + +// 执行请求 +$response = curl_exec($ch); +$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); +$error = curl_error($ch); +curl_close($ch); + +// 处理响应 +if ($httpCode === 200) { + $data = json_decode($response); + if (isset($data->jwt)) { + $jwt = $data->jwt; + +$file = 'jwt.txt'; + +// 将数据写入文件 +file_put_contents($file, $jwt); + + } else { + echo "响应中缺少JWT令牌"; + } +} else { + echo "认证失败,错误信息:" . ($response ?: '无响应内容'); +} + +// 错误处理 +if ($error) { + echo "cURL错误:" . $error; +} + + diff --git a/More/Get.php.bak b/More/Get.php.bak new file mode 100644 index 0000000..e440c3b --- /dev/null +++ b/More/Get.php.bak @@ -0,0 +1,50 @@ + '19884551721', + 'password' => 'LX5bH76SJf9E' +]; + +// 初始化cURL +$ch = curl_init($url); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回响应内容而不直接输出 +curl_setopt($ch, CURLOPT_POST, true); // 使用POST方法 +curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json' // 设置JSON头 +]); +curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); // JSON编码数据 + +// 执行请求 +$response = curl_exec($ch); +$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); +$error = curl_error($ch); +curl_close($ch); + +// 处理响应 +if ($httpCode === 200) { + $data = json_decode($response); + if (isset($data->jwt)) { + $jwt = $data->jwt; + [ + 'header' => "authorization: JWT " . $jwt . "\r\n" . + "Content-Type: application/json\r\n", + 'method' => 'GET', // 或 POST、PUT 等 + 'ignore_errors' => true // 忽略 HTTP 错误码(如 401) + ] +]; + +$context = stream_context_create($options); +$response = file_get_contents("https://www.007idc.cn/v1/hosts/57431/module/status?type=host", false, $context); +echo $response; +?> diff --git a/More/t.php.bak b/More/t.php.bak new file mode 100644 index 0000000..e05980b --- /dev/null +++ b/More/t.php.bak @@ -0,0 +1,16 @@ + [ + 'header' => "authorization: JWT " . $jwt . "\r\n" . + "Content-Type: application/json\r\n", + 'method' => 'GET', // 或 POST、PUT 等 + 'ignore_errors' => true // 忽略 HTTP 错误码(如 401) + ] +]; + +$context = stream_context_create($options); +$response = file_get_contents("https://www.007idc.cn/v1/hosts/57431/module/status", false, $context); +echo $response; +?>