百度百科接口
equalizer 累计使用:6974
请求地址 https://free.wqwlkj.cn/wqwlapi/baidu_bk.php
请求示例 https://free.wqwlkj.cn/wqwlapi/baidu_bk.php?msg=QQ&type=json
请求方式 GET/POST
返回格式 JSON
{
"code": 1,
"text": "获取成功",
"data": {
"Msg": "QQ",
"info": "QQ(原名:OICQ,又名腾讯QQ),是深圳市腾讯计算机系统有限公司推出的一款基于互联网即时通信软件,于1999年2月10日上线。覆盖了Windows、macOS、iPadOS、Android、iOS、Windows Phone、Linux等多种操作平台。其标志是一只戴着红色围巾的小企鹅。腾讯QQ支持在线聊天、视频通话、点对点断点续传文件、共享文件、网络硬盘、自定义面板、QQ邮箱等多种功能,并可与多种通讯终端相连。2020年1月,2020年全球最具价值500大品牌榜发布,腾讯QQ排名第27位。2024年3月,根据腾讯发布的2023三季度报告,截至2023年9月底,QQ月活用户达5.58亿。",
"image": "https://bkimg.cdn.bcebos.com/smart/242dd42a2834349b033bb3129abe02ce36d3d5391055-bkimg-process,v_1,rw_1,rh_1,maxl_114,pad_1,color_ffffff?x-bce-process=image/format,f_auto",
"url": "https://wapbaike.baidu.com/item/QQ/111306"
}
}
参数名称 | 是否必需 | 参数说明 |
---|---|---|
msg |
否 | 需要百科的内容 |
type |
否 | 可选json text 默认json |
参数名称 | 参数类型 | 参数说明 |
---|---|---|
code |
integer |
1成功-1失败 |
text |
string |
返回结果 |
data |
string |
获取到的数据 |
更新时间 2023-08-08 14:07:13
状态码 | 状态说明 |
---|---|
400 | 请求错误 |
403 | 请求被服务器拒绝 |
404 | 请求服务器失败 |
500 | 服务器错误 |
503 | 服务器维护 |
GET方法
$url = 'https://free.wqwlkj.cn/wqwlapi/baidu_bk.php';
$data = '?msg=QQ&type=json';
$get = $url.$data;
$result = file_get_contents($get);
if ($result) {
//成功
echo $result;
} else {
//失败
}
POST方法
$url = 'https://free.wqwlkj.cn/wqwlapi/baidu_bk.php';
$data = array(
  'msg' => 'QQ',
  'type' => 'json',
);
$data = http_build_query($data);
$option = array('http'=>array('method'=>'POST','content'=>$data));
$context = stream_context_create($option);
$result = file_get_contents($url,false,$context);
if ($result) {
//成功
echo $result;
} else {
//失败
}
GET方法
var url = "https://free.wqwlkj.cn/wqwlapi/baidu_bk.php"
var data = "?msg=QQ&type=json"
var xhrGet = new XMLHttpRequest();
xhrGet.open('GET', url + data, true);
xhrGet.send();
xhrGet.onreadystatechange = function() {
if (xhrGet.readyState == 4 && xhrGet.status == 200) {
//成功
var result = xhrGet.responseText;
console.log(result);
} else {
//失败
}
};
POST方法
var url = "https://free.wqwlkj.cn/wqwlapi/baidu_bk.php"
var data = "msg=QQ&type=json"
var xhrPost = new XMLHttpRequest();
xhrPost.open('POST', url, true);
xhrPost.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhrPost.send(data);
xhrPost.onreadystatechange = function() {
if (xhrPost.readyState == 4 && xhrPost.status == 200) {
//成功
var result = xhrPost.responseText;
console.log(result);
} else {
//失败
}
};
GET方法
new Thread(){
public void run() {
String path = "https://free.wqwlkj.cn/wqwlapi/baidu_bk.php";
String data = "?msg=QQ&type=json";
try {
URL url = new URL(path + data);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
int code = connection.getResponseCode();
if (code == 200) {
//成功
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader bufferedreader = new BufferedReader(isr);
String string;
StringBuilder stringbuilder = new StringBuilder();
while ((string = bufferedreader.readLine()) != null) {
stringbuilder.append(string);
}
final String result = stringbuilder.toString();
System.out.println(result);
} else {
//失败
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}}.start();
POST方法
new Thread(){
public void run() {
String path = "https://free.wqwlkj.cn/wqwlapi/baidu_bk.php";
String data = "msg=QQ&type=json";
try {
URL url = new URL(path);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.getOutputStream().write(data.getBytes());
int code = connection.getResponseCode();
if (code == 200) {
//成功
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader bufferedreader = new BufferedReader(isr);
String string;
StringBuilder stringbuilder = new StringBuilder();
while ((string = bufferedreader.readLine()) != null) {
stringbuilder.append(string);
}
final String result = stringbuilder.toString();
System.out.println(result);
} else {
//失败
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}}.start();
GET方法
url="https://free.wqwlkj.cn/wqwlapi/baidu_bk.php"
data=url.."?msg=QQ&type=json"
Http.get(data,function(code,content,data)
if code==200 then
--成功
print(content)
else
--失败
end
end)
POST方法
url="https://free.wqwlkj.cn/wqwlapi/baidu_bk.php"
data="msg=QQ&type=json"
Http.post(url,data,function(code,content,data)
if code==200 then
--成功
print(content)
else
--失败
end
end)
GET方法
变量 网络GET操作 为 网络操作 = 创建 网络操作()
变量 GET数据 为 文本型 = "?msg=QQ&type=json"
网络GET操作.取网页源码("https://free.wqwlkj.cn/wqwlapi/baidu_bk.php" + GET数据)
事件 网络GET操作:取网页源码结束(结果 为 文本型,cookie 为 文本型)
//成功
调试输出(结果)
结束 事件
事件 网络GET操作:取网页源码失败(响应码 为 文本型)
//失败
结束 事件
POST方法
变量 网络POST操作 为 网络操作 = 创建 网络操作()
变量 POST数据 为 文本型 = "msg=QQ&type=json"
网络POST操作.发送数据("https://free.wqwlkj.cn/wqwlapi/baidu_bk.php",POST数据)
事件 网络POST操作:发送数据结束(结果 为 文本型,cookie 为 文本型)
//成功
调试输出(结果)
结束 事件
事件 网络POST操作:发送数据失败(响应码 为 文本型)
//失败
结束 事件
GET方法
s url="https://free.wqwlkj.cn/wqwlapi/baidu_bk.php"
s data="?msg=QQ&type=json"
ss(url+data,get)
t(){
hs(get,result)
f(result!=null){
//成功
syso(result)
}else{
//失败
}
}
POST方法
s url="https://free.wqwlkj.cn/wqwlapi/baidu_bk.php"
s data="msg=QQ&type=json"
t(){
hs(url,data,"utf-8",result)
f(result!=null){
//成功
syso(result)
}else{
//失败
}
}
反馈时间 | 反馈接口 | 反馈内容 | 反馈者IP |
---|