接口地址:https://api.66mz8.com/api/today.php |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://api.66mz8.com/api/today.php?format=json |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
format | string | 选填 | 返回类型 |
名称 | 类型 | 说明 |
---|---|---|
- | - | - |
{
"code": 200,
"data": [{
"date": "2018年5月1日",
"message": "蒙古自治区成立70周年"
},
{
"date": "2009年5月1日",
"message": "杭州湾跨海大桥试运营通车"
},
{
"date": "1995年5月1日",
"message": "第43届世界乒乓球锦标赛在天津举行"
},
{
"date": "1995年5月1日",
"message": "联合国决定1995年为国际宽容年"
},
{
"date": "1995年5月1日",
"message": "我国在全国范围内正式开始实行一周双休制"
},
{
"date": "1994年5月1日",
"message": "法国前总理贝雷戈瓦自杀身亡"
},
{
"date": "1993年5月1日",
"message": "中央电视台《东方时空》栏目开播"
},
{
"date": "1991年5月1日",
"message": "我们海陆空统一换着新制式服装"
},
{
"date": "1978年5月1日",
"message": "前苏联作曲家阿拉姆·伊里奇·哈恰图良逝世"
},
{
"date": "1964年5月1日",
"message": "我国第一艘远洋货轮“跃进号”沉没"
}
]
}
错误码 | 说明 |
---|---|
- | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2020/05/01 13:26
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://api.66mz8.com/api/today.php?format=json';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://api.66mz8.com/api/today.php?format=json"
)
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))
}