💡 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/bazi | 在线体验接口
请求方法: [ "GET", "POST" ]
请求参数:
名称类型描述示例
tokenstring请求的token用户中心获取token
datestring请填写阳历(公历)时间,格式 年月日时分2005年04月19日 0点4分
sexstring男,女
-- Response Format --
返回数据:
{
    "status": 1,
    "data": {
        "年": "2005",
        "月": "04",
        "日": "19",
        "时": "子",
        "天干": [
            "食神",
            "正印",
            "日主",
            "劫财"
        ],
        "八字": [
            "乙酉",
            "庚辰",
            "癸酉",
            "壬子"
        ],
        "地支": [
            "偏印",
            "正官",
            "偏印",
            "比肩"
        ],
        "五行": [
            "木金",
            "金土",
            "水金",
            "水水"
        ],
        "纳音": [
            "泉中水",
            "白蜡金",
            "剑锋金",
            "桑柘木"
        ],
        "地势": [
            "病",
            "养",
            "病",
            "临官"
        ],
        "胎元": "辛未(路旁土)",
        "胎息": "戊辰(大林木)",
        "命宫": "己丑(霹雳火)",
        "身宫": "辛巳(白蜡金)",
        "日空": "甲子",
        "起运": "4年8个月后起运,起运公历:2009-12-19",
        "大运信息": [
            {
                "开始年": 2005,
                "结束年": 2008,
                "开始年龄": 1,
                "结束年龄": 4,
                "干支": ""
            },
            {
                "开始年": 2009,
                "结束年": 2018,
                "开始年龄": 5,
                "结束年龄": 14,
                "干支": "己卯"
            },
            {
                "开始年": 2019,
                "结束年": 2028,
                "开始年龄": 15,
                "结束年龄": 24,
                "干支": "戊寅"
            },
            {
                "开始年": 2029,
                "结束年": 2038,
                "开始年龄": 25,
                "结束年龄": 34,
                "干支": "丁丑"
            },
            {
                "开始年": 2039,
                "结束年": 2048,
                "开始年龄": 35,
                "结束年龄": 44,
                "干支": "丙子"
            },
            {
                "开始年": 2049,
                "结束年": 2058,
                "开始年龄": 45,
                "结束年龄": 54,
                "干支": "乙亥"
            },
            {
                "开始年": 2059,
                "结束年": 2068,
                "开始年龄": 55,
                "结束年龄": 64,
                "干支": "甲戌"
            },
            {
                "开始年": 2069,
                "结束年": 2078,
                "开始年龄": 65,
                "结束年龄": 74,
                "干支": "癸酉"
            },
            {
                "开始年": 2079,
                "结束年": 2088,
                "开始年龄": 75,
                "结束年龄": 84,
                "干支": "壬申"
            },
            {
                "开始年": 2089,
                "结束年": 2098,
                "开始年龄": 85,
                "结束年龄": 94,
                "干支": "辛未"
            }
        ]
    }
}
                
Code Examples:
  • Curl
  • PHP
  • Java
  • Python
  • JavaScript
  • Go
curl -X POST \
  http://api.toolfk.com/api/bazi \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'token=用户中心获取&date=2005%E5%B9%B404%E6%9C%8819%E6%97%A5+0%E7%82%B94%E5%88%86&sex=%E7%94%B7'
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.toolfk.com/api/bazi",
  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=用户中心获取&date=2005%E5%B9%B404%E6%9C%8819%E6%97%A5+0%E7%82%B94%E5%88%86&sex=%E7%94%B7",
  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=用户中心获取&date=2005%E5%B9%B404%E6%9C%8819%E6%97%A5+0%E7%82%B94%E5%88%86&sex=%E7%94%B7");
Request request = new Request.Builder()
  .url("http://api.toolfk.com/api/bazi")
  .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/bazi"

payload = "token=用户中心获取&date=2005%E5%B9%B404%E6%9C%8819%E6%97%A5+0%E7%82%B94%E5%88%86&sex=%E7%94%B7"
headers = {'Content-Type': "application/x-www-form-urlencoded"}

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

print(response.text)
var data = "token=用户中心获取&date=2005%E5%B9%B404%E6%9C%8819%E6%97%A5+0%E7%82%B94%E5%88%86&sex=%E7%94%B7";

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/bazi");
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/bazi"
	payload := strings.NewReader("token=用户中心获取&date=2005%E5%B9%B404%E6%9C%8819%E6%97%A5+0%E7%82%B94%E5%88%86&sex=%E7%94%B7")

	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.