八字大运API接口

八字大运交运时间怎么看?传统命理中认为每个人诞生的时候都会带上出生时候的属性,这也是八字算命的根据,根据男女性别准确在线算出男女起运年龄与日期。八字算命带你了解八字背后的秘密。

接口文档 《查看会员》
接口地址: http://api.toolfk.com/api/bazi | 在线体验接口
请求方法: [ "GET", "POST" ]
请求参数:
名称 类型 描述 示例
token string 请求的token 用户中心获取token
date string 请填写阳历(公历)时间,格式 年月日时分 2005年04月19日 0点4分
sex string 男,女
-- 漂亮的分割符 --
返回数据:

{
    "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,
                "干支": "辛未"
            }
        ]
    }
}
                
                            
代码示例:
  • Curl
  • PHP
  • Java
  • Python
  • JavaScript
  • Go
  • Nodejs

    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) {
        console.log(this.responseText);
    }
});

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)

	async res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
package main

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

func main() {

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

        payload := strings.NewReader("{
          "token": "用户中心获取token",
          "type": "a",
          "format": "json"
        }")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	async res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                                       
返回状态码 status 描述参照
返回码 描述
status 1:表示成功,0:表示失败
data 成功返回数据
errmsg 失败返回数据
备注:开通API接口服务,可同时享用 www.toolfk.com 网站的会员工具。