- 例子 通过API 安装KZTIMER
Python
import requests
# 构建请求头
request_header = {
"Content-Type": "application/json",
"X-Auth-Token": "这里填写您服务器Token令牌值"
}
# 设置参数 MOD名称
post_data = {
"modname": "csgoserver_kztimer"
}
url = "https://f.upkk.com/plugin.php?id=srcds_server_user_manager:api_v1&module=L-app-Install-Mod"
try:
response = requests.post(url, headers=request_header, json=post_data, timeout=20, verify=False)
# 如果您需要验证 SSL 证书,请将 verify 设置为 True,并提供证书路径
# response = requests.post(url, headers=request_header, json=post_data, 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令牌值"
);
//设置参数 MOD名称
$postArray = array(
"modname" => 'csgoserver_kztimer'
);
//设置请求地址
$ch = curl_init('https://f.upkk.com/plugin.php?id=srcds_server_user_manager:api_v1&module=L-app-Install-Mod');
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_HTTPHEADER, $requestHeader);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postArray);
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:46
最后编辑:admin 更新时间:2024-09-25 02:22
最后编辑:admin 更新时间:2024-09-25 02:22