QQ信息查询源码

使用了寂寞 API 提供的接口。我看他的 API 都没人怎么用,我给他用起来,哈哈。能查询 QQ 等级,注册时间,Q 龄

图片演示:

图片[1]|QQ信息查询源码|不死鸟资源网

我直接放主题里测试的,css 会有冲突,前端可能有点丑,自己美化一下就好。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>查询QQ用户信息</title>
<style>
  body {
    font-family: Arial, sans-serif;
    padding: 20px;
  }
  .container {
    max-width: 600px;
    margin: 0 auto;
  }
  input, button {
    padding: 10px;
    margin-top: 10px;
    font-size: 16px;
  }
</style>
</head>
<body>
<div class="container">
  <h2>查询QQ用户信息</h2>
  <input type="text" id="qqNumber" placeholder="请输入QQ号码">
  <button onclick="fetchUserData()">查询</button>
  <div id="result">
    <!-- 结果将在这里显示 -->
  </div>
</div>

<script>
function fetchUserData() {
  const qqNumber = document.getElementById('qqNumber').value;
  const apiUrl = `https://api.jmjm.tk/api/qqzcdj/?qq=${qqNumber}`;
  
  // 使用Fetch API发送请求
  fetch(apiUrl)
    .then(response => {
      if (!response.ok) {
        throw new Error('Network response was not ok');
      }
      return response.json();
    })
    .then(data => {
      displayResult(data);
    })
    .catch(error => {
      console.error('There has been a problem with your fetch operation:', error);
      document.getElementById('result').innerText = '请求失败: ' + error.message;
    });
}

function displayResult(data) {
  const resultDiv = document.getElementById('result');
  if (data.status === 'success') {
    resultDiv.innerHTML = `
      <p><strong>QQ号:</strong> ${data.user_id}</p>
      <p><strong>昵称:</strong> ${data.nickname}</p>
      <p><strong>QQ等级:</strong> ${data.qqLevel}</p>
      <p><strong>注册时间:</strong> ${data.reg_time}</p>
      <p><strong>QQ年龄:</strong> ${data.qq_age}</p>
    `;
  } else {
    resultDiv.innerHTML = '<p>查询失败,请检查输入的QQ号码是否正确。</p>';
  }
}
</script>
</body>
</html>

本站资源均为作者提供和网友推荐收集整理而来,仅供学习和研究使用,请在下载后24小时内删除,谢谢合作!
QQ信息查询源码|不死鸟资源网
QQ信息查询源码
此内容为免费阅读,请登录后查看
¥0
限时特惠
¥99
文章采用CC BY-NC-SA 4.0许可协议授权
免费阅读
THE END
点赞6 分享