<?php
// 要调用的 URL
$url = "https://api.qster.top/API/v1/bingtu";
// 参数数组
$params = [
"qskey" => "0",
];
// 使用 http_build_query 将参数转换为查询字符串
$queryString = http_build_query($params);
// 在 URL 中添加查询字符串
$finalUrl = $url . '?' . $queryString;
// 使用 file_get_contents 获取内容
$response = file_get_contents($finalUrl);
// 输出响应
echo $response;
?>
import requests
url = "https://api.qster.top/API/v1/bingtu";
params = {
"qskey" => "0"
}
response = requests.get(url, params=params)
print(response.text)
function fetchData(url, params) {
const queryString = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
.join('&');
const fullUrl = `${url}?${queryString}`;
fetch(fullUrl)
.then(response => response.text())
.then(data => {
const resultElement = document.createElement('pre');
resultElement.textContent = data;
document.body.appendChild(resultElement);
})
.catch(error => console.error('Error fetching data:', error));
}
// 示例用法
const url = "https://api.qster.top/API/v1/bingtu";
const params = {
"qskey" => "0"
};
fetchData(url, params);