# GET:参数放 URL
curl -X GET "https://www.tkhao.vip/api/purchase?goods_id=3518&sub_id=5000&quantity=1" \
-H "X-API-Key: your_api_key"
# POST:参数放 JSON body
curl -X POST "https://www.tkhao.vip/api/purchase" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{"goods_id":3518,"sub_id":5000,"quantity":1}'
// GET:参数放 URL
$url = "https://www.tkhao.vip/api/purchase?goods_id=3518&sub_id=5000&quantity=1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: your_api_key"]);
$response = curl_exec($ch);
curl_close($ch);
// POST:参数放 JSON body
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.tkhao.vip/api/purchase");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(["goods_id" => 3518, "sub_id" => 5000, "quantity" => 1]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: your_api_key", "Content-Type: application/json"]);
$response = curl_exec($ch);
curl_close($ch);
import requests
headers = {"X-API-Key": "your_api_key"}
# GET:参数放 URL
response = requests.get(
"https://www.tkhao.vip/api/purchase",
params={"goods_id": 3518, "sub_id": 5000, "quantity": 1},
headers=headers
)
# POST:参数放 JSON body
response = requests.post(
"https://www.tkhao.vip/api/purchase",
json={"goods_id": 3518, "sub_id": 5000, "quantity": 1},
headers={**headers, "Content-Type": "application/json"}
)
// GET:参数放 URL
fetch("https://www.tkhao.vip/api/purchase?goods_id=3518&sub_id=5000&quantity=1", {
method: "GET",
headers: { "X-API-Key": "your_api_key" }
})
.then(r => r.json()).then(data => console.log(data));
// POST:参数放 JSON body
fetch("https://www.tkhao.vip/api/purchase", {
method: "POST",
headers: { "X-API-Key": "your_api_key", "Content-Type": "application/json" },
body: JSON.stringify({ goods_id: 3518, sub_id: 5000, quantity: 1 })
})
.then(r => r.json()).then(data => console.log(data));