💡 ToolFK provides all tools free of charge. The ads you see help us keep the site running sustainably. Thank you for your support! ❤️ ToolFK tools are free. Ads help keep the site running. Thanks! ❤️

历史上的今天 API

通过 API 获取历史上的今天大事与纪念,提供详细事件数据,支持快速调用。

接口文档 《查看会员》
接口地址: http://api.toolfk.com/api/history
请求方法: [ "GET", "POST" ]
请求参数:
名称类型描述示例
tokenstring请求的token用户中心获取token
-- Response Format --
返回数据:
{
    "status": 1,
    "data": [
        {
            "title": "1135年-宋朝著名抗金女英雄梁红玉遇难",
            "desc": "梁红玉(1102年—1135年10月6日),宋朝抗金女英雄,韩世忠之妾。梁红玉生于宋徽宗崇宁元年,祖父与父亲都是武将出身,梁红玉自幼随侍父兄练就了一身功夫。韩世忠与梁红玉初次见面是在平定方腊后的庆功宴上,两人日久生情,终成眷属。建炎三年,在平定苗傅叛乱中立下殊勋,一夜奔驰数百里召韩世忠入卫平叛,因此被封为安国夫人和护国夫人,后多次随夫出征。在建炎四年长江阻击战中亲执桴鼓,和韩世忠共同指挥作战,将入侵的金军阻击在长江南岸达48天之久,从此名震天下。",
            "img": "https://so1.360tres.com/t01a9a9504b617cc41a.jpg",
            "year": "1135"
        },
    ]
}
Code Examples:
  • Curl
  • PHP
  • Java
  • Python
  • JavaScript
  • Go
curl -X POST \
  http://api.toolfk.com/api/history \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'token=用户中心获取'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.toolfk.com/api/history",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "token=用户中心获取",
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "token=用户中心获取");
Request request = new Request.Builder()
  .url("http://api.toolfk.com/api/history")
  .post(body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();

Response response = client.newCall(request).execute();
import requests

url = "http://api.toolfk.com/api/history"

payload = "token=用户中心获取"
headers = {'Content-Type': "application/x-www-form-urlencoded"}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
var data = "token=用户中心获取";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
        if (this.readyState === 4 && this.status >= 400) {
            layer.msg('Request failed: ' + this.status);
        }
    }
});

xhr.open("POST", "http://api.toolfk.com/api/history");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.send(data);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {
	url := "http://api.toolfk.com/api/history"
	payload := strings.NewReader("token=用户中心获取")

	req, _ := http.NewRequest("POST", url, payload)
	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))
}
返回状态码 status 描述参照
返回码描述
status1:表示成功,0:表示失败
data成功返回数据
errmsg失败返回数据
Note: By subscribing to the API service, you will also enjoy VIP membership benefits on www.toolfk.com.