<?php
/**
- 模板名:API 查询页面
*/
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>API 查询</title>
<style>
.api-box{max-width:360px;margin:20px auto;font-family:Arial;}
.api-box input{width:100%;padding:10px;margin-bottom:10px;box-sizing:border-box;}
.api-box button{width:100%;padding:10px;background:#007bff;color:white;border:none;border-radius:4px;cursor:pointer;}
.result{margin-top:10px;padding:10px;background:#f5f5f5;border-radius:4px;white-space:pre-wrap;font-size:14px;}
</style></head>
<body>
<div class="api-box">
<input type="text" id="content" placeholder="请输入查询内容">
<button onclick="search()">查询</button>
<div class="result" id="result"></div>
</div>
<script>
async function search() {
const result = document.getElementById('result');
const text = document.getElementById('content').value.trim();
if (!text) { result.innerText = '请输入内容'; return; }
result.innerText = '查询中...';
try {
const key = '你的秘钥KEY'; // 替换成你的真实KEY
const url = `https://openapi.dwo.cc/api/v?key=${encodeURIComponent(key)}&msg=${encodeURIComponent(text)}`;
const res = await fetch(url);
const data = await res.json();
result.innerText = JSON.stringify(data, null, 2);
} catch (err) {
result.innerText = '查询失败:' + err.message;
}
}
</script></body>
</html>
white;border:none;border-radius:4px;cursor:pointer;}
.result{margin-top:10px;padding:10px;background:#f5f5f5;border-radius:4px;white-space:pre-wrap;font-size:14px;}
</style>
<div class="api-box">
<input type="text" id="content" placeholder="请输入查询内容">
<button onclick="search()">查询</button>
<div class="result" id="result"></div>
</div>
<script>
async function search() {
const result = document.getElementById('result');
const text = document.getElementById('content').value.trim();
if (!text) { result.innerText = '请输入内容'; return; }
result.innerText = '查询中...';
try {
const key = '你的秘钥KEY'; // 这里替换成你的真实KEY
const url = `https://openapi.dwo.cc/api/v?key=${encodeURIComponent(key)}&msg=${encodeURIComponent(text)}`;
const res = await fetch(url);
const data = await res.json();
result.innerText = JSON.stringify(data, null, 2);} catch (err) {
result.innerText = '查询失败:' + err.message;}
}
</script>
<!--/raw-->
:pointer;}
.result{margin-top:10px;padding:10px;background:#f5f5f5;border-radius:4px;white-space:pre-wrap;font-size:14px;}
</style>
<div class="api-box">
<input type="text" id="content" placeholder="请输入查询内容">
<button onclick="search()">查询</button>
<div class="result" id="result"></div>
</div>
<script>
async function search() {
const result = document.getElementById('result');
const text = document.getElementById('content').value.trim();
if (!text) {
result.innerText = '请输入内容';
return;}
result.innerText = '查询中...';
try {
// 替换成你的真实KEY
const key = '你的秘钥KEY';
const url = `https://openapi.dwo.cc/api/v?key=${encodeURIComponent(key)}&msg=${encodeURIComponent(text)}`;
const res = await fetch(url);
const data = await res.json();
result.innerText = JSON.stringify(data, null, 2);} catch (err) {
result.innerText = '查询失败:' + err.message;}
}
</script>
查询</button>
<div class="result" id="result"></div>
</div>
<script>
async function search() {
const result = document.getElementById('result');
const text = document.getElementById('content').value.trim();
if (!text) {
result.innerText = '请输入内容';
return;}
result.innerText = '查询中...';
try {
// 在这里填入你的 KEY
const key = '这里替换成你的真实KEY';
const url = `https://openapi.dwo.cc/api/v?key=${encodeURIComponent(key)}&msg=${encodeURIComponent(text)}`;
const res = await fetch(url);
const data = await res.json();
result.innerText = JSON.stringify(data, null, 2);} catch (err) {
result.innerText = '查询失败:' + err.message;}
}
</script>
本文共 137 个字数,平均阅读时长 ≈ 1分钟
评论