上传文件至 More
This commit is contained in:
50
More/Get.php
Normal file
50
More/Get.php
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
include_once "../Main/Hv4.Function.php";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$url = 'https://www.007idc.cn/v1/login_api';
|
||||||
|
$payload = [
|
||||||
|
'account' => '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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
50
More/Get.php.bak
Normal file
50
More/Get.php.bak
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
include_once "../Main/Hv4.Function.php";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$url = 'https://www.007idc.cn/v1/login_api';
|
||||||
|
$payload = [
|
||||||
|
'account' => '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;
|
||||||
|
<?php
|
||||||
|
$file = 'jwt.txt';
|
||||||
|
|
||||||
|
// 将数据写入文件
|
||||||
|
file_put_contents($file, $jwt);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo "响应中缺少JWT令牌";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "认证失败,错误信息:" . ($response ?: '无响应内容');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 错误处理
|
||||||
|
if ($error) {
|
||||||
|
echo "cURL错误:" . $error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
1
More/jwt.txt
Normal file
1
More/jwt.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyaW5mbyI6eyJpZCI6NDUwMywidXNlcm5hbWUiOiJcdTRmNTlcdTY2MTVcdTViNjkifSwiaXNzIjoid3d3LmlkY1NtYXJ0LmNvbSIsImF1ZCI6Ind3dy5pZGNTbWFydC5jb20iLCJpcCI6IjQ3Ljk2LjIyNS4xOTAiLCJpYXQiOjE3NDEwODU0OTgsIm5iZiI6MTc0MTA4NTQ5OCwiZXhwIjoxNzQxMDkyNjk4fQ.N9d6V1gkBnqKNAwCaM918FJyUdx4dg-tsGMM_jgXiXA
|
||||||
16
More/t.php
Normal file
16
More/t.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
$jwt = file_get_contents("./jwt.txt"); // 你的 JWT
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
'http' => [
|
||||||
|
'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;
|
||||||
|
?>
|
||||||
16
More/t.php.bak
Normal file
16
More/t.php.bak
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
$jwt = file_get_contents("./jwt.txt"); // 你的 JWT
|
||||||
|
|
||||||
|
$options = [
|
||||||
|
'http' => [
|
||||||
|
'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;
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user