https://api.cenguigui.cn/api/qq/qq.php
GET
JSON
正常启用
以下参数为接口所需调用信息
参数 | 是否必填 | 说明 | |
---|---|---|---|
QQ头像加密地址获取 | 是 | ?qq=QQ号 |
https://api.cenguigui.cn/api/qq/qq.php?qq=778713968
<!--html示例--> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>获取头像</title> </head> <body> <h1>获取头像</h1> <div id="guigui_avatar"></div> <script> // 使用XMLHttpRequest发送GET请求获取头像信息 var xhr = new XMLHttpRequest(); xhr.open("GET", "https://api.cenguigui.cn/api/qq/qq.php?qq=778713968", true); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { var response = JSON.parse(xhr.responseText); if (response.code === "200" && response.avatar_url) { var avatarUrl = response.avatar_url; var imageElement = document.createElement("img"); imageElement.src = avatarUrl; document.getElementById("guigui_avatar").appendChild(imageElement); } else { console.error("获取头像失败: " + response.msg); } } }; xhr.send(); </script> </body> </html>