返回数据:
{
"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))
}
|