接口地址:https://api.oick.cn/lishi/api.php |
---|
返回格式:json |
请求方式:get |
请求示例:https://api.oick.cn/lishi/api.php |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
- | - | - | - |
名称 | 类型 | 说明 |
---|---|---|
- | - | - |
{
"code": "1",
"day": "04/ 28",
"result": [{
"date": "1442年04月28日",
"title": "英国国王爱德华四世出生"
},
{
"date": "1813年04月28日",
"title": "俄国名将库图佐夫逝世"
},
{
"date": "1897年04月28日",
"title": "中国军事家叶剑英出生"
},
{
"date": "1900年04月28日",
"title": "荷兰天文学家简·亨德里克·奥尔特出生"
},
{
"date": "1903年04月28日",
"title": "美国物理学家吉布斯逝世"
},
{
"date": "1906年04月28日",
"title": "奥地利数学家库尔特·哥德尔出生"
},
{
"date": "1908年04月28日",
"title": "德国商人奥斯卡·辛德勒出生"
},
{
"date": "1910年04月28日",
"title": "南北战争的将领爱德华·波特·亚历山大逝世"
},
{
"date": "1920年04月28日",
"title": "阿塞拜疆加入苏联"
},
{
"date": "1927年04月28日",
"title": "中国革命家李大钊逝世"
},
{
"date": "1952年04月28日",
"title": "《旧金山对日和平条约》正式生效"
},
{
"date": "1969年04月28日",
"title": "戴高乐辞去法国总统职务"
},
{
"date": "1984年04月28日",
"title": "邓小平会见罗纳德·威尔逊·里根"
},
{
"date": "1985年04月28日",
"title": "中国作家张天翼逝世"
},
{
"date": "2001年04月28日",
"title": "世界首位太空游客丹尼斯·蒂托前往太空站"
}
]
}
错误码 | 说明 |
---|---|
- | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2021/11/09 09:08
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://api.oick.cn/lishi/api.php';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://api.oick.cn/lishi/api.php"
)
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))
}