接口地址:https://dict-mobile.iciba.com/interface/index.php |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://dict-mobile.iciba.com/interface/index.php?c=word&m=getsuggest&nums=10&is_need_mean=1&word=h |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
c | string | 必填 | 固定值:word |
m | string | 必填 | 固定值:getsuggest |
is_need_mean | int | 必填 | 词语含义 |
word | string | 必填 | 搜索的单词 |
名称 | 类型 | 说明 |
---|---|---|
key | string | 搜索的单词 |
paraphrase | string | 解释 |
means | object | 词语含义 |
{
"message": [{
"key": "hello",
"paraphrase": "n.“喂”的招呼声或问候声;int.哈喽,喂,你好,您好,表示问候,打招呼",
"value": 0,
"means": [{
"part": "int.",
"means": [
"哈喽,喂",
"你好,您好",
"表示问候",
"打招呼"
]
},
{
"part": "n.",
"means": [
"“喂”的招呼声或问候声"
]
}
]
}],
"status": 1
}
错误码 | 说明 |
---|---|
101 | 验证失败 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2021/07/03 19:26
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://dict-mobile.iciba.com/interface/index.php?c=word&m=getsuggest&nums=10&is_need_mean=1&word=h';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://dict-mobile.iciba.com/interface/index.php?c=word&m=getsuggest&nums=10&is_need_mean=1&word=h"
)
func main() {
queryUrl := fmt.Sprintf("%s",APIURL)
resp, err := http.Get(queryUrl)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}