- 例子 重启服务器
Python
import requests
# 构建请求头
request_header = {
"Content-Type": "application/json",
"X-Auth-Token": "这里填写您服务器Token令牌值"
}
url = "https://f.upkk.com/plugin.php?id=srcds_server_user_manager:api_v1&module=L-app-restart"
try:
response = requests.get(url, headers=request_header, timeout=20, verify=False)
# 如果您需要检查 SSL 证书,请将 verify 设置为 True,并提供证书路径
# response = requests.get(url, headers=request_header, timeout=20, verify="path/to/certificate.crt")
# 打印响应内容
print(response.text)
except requests.exceptions.RequestException as e:
print("请求发生错误:", e)
PHP
<?php
//构建请求头
$requestHeader = array(
"Content-Type: application/json",
"X-Auth-Token:这里填写您服务器Token令牌值"
);
$ch = curl_init("https://f.upkk.com/plugin.php?id=srcds_server_user_manager:api_v1&module=L-app-restart");
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER, $requestHeader);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
作者:admin 创建时间:2020-09-04 14:41
最后编辑:admin 更新时间:2024-09-25 02:22
最后编辑:admin 更新时间:2024-09-25 02:22