<?php
//密钥
$api_secret = "wD******XhOUW******pvr";
//请求网关
$gateway_host_url = "https://doc.yuanfenju.com/bazi/paipan.html";
//请求参数
$curlPost['name'] = "张三";
$curlPost['sex'] = "0";
$curlPost['type'] = "0";
$curlPost['year'] = "1988";
$curlPost['month'] = "11";
$curlPost['day'] = "8";
$curlPost['hours'] = "12";
$curlPost['minute'] = "20";
$curlPost['api_key'] = $api_secret;
//curl
function curlSend($process_gateway, $data_arr, $type = 1) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $process_gateway);
curl_setopt($ch, CURLOPT_POST, $type);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data_arr));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
function process_host($curlPost,$gateway_url) {
$response = curlSend($gateway_url,$curlPost,1);
print_r($response);
}
process_host($curlPost,$gateway_host_url);
返回:
{
"errcode": 0,
"errmsg": "请求成功",
"data": {
"base_info": {
"sex": "乾造",
"name": "张三",
"gongli": "1988年12月16日12时20分",
"nongli": "戊辰年 十一月 初八日 午时",
"qiyun": "6年8月22天起运",
"jiaoyun": "1995年8月4日16时48分56秒"
},
"bazi_info": {
"kw": "寅卯",
"tg_cg_god": ["才", "劫", "日元", "印"],
"bazi": ["戊辰", "甲子", "乙巳", "壬午"],
"dz_cg": ["戊|乙|癸", "癸", "丙|戊|庚", "丁|己"],
"dz_cg_god": ["才|比|枭", "枭", "伤|才|官", "食|财"],
"day_cs": ["冠带", "病", "沐浴", "长生"],
"na_yin": ["大林木", "海中金", "佛灯火", "杨柳木"]
},
"dayun_info": {
"big_god": ["比", "伤", "食", "才", "财", "官", "杀", "印", "枭", "劫", "比", "伤"],
"big": ["乙丑", "丙寅", "丁卯", "戊辰", "己巳", "庚午", "辛未", "壬申", "癸酉", "甲戌", "乙亥", "丙子"],
"big_cs": ["衰", "帝旺", "临官", "冠带", "沐浴", "长生", "养", "胎", "绝", "墓", "死", "病"],
"xu_sui": [8, 18, 28, 38, 48, 58, 68, 78, 88, 98, 108, 118],
"big_start_year": [1995, 2005, 2015, 2025, 2035, 2045, 2055, 2065, 2075, 2085, 2095, 2105],
"big_start_year_liu_nian": "",
"big_end_year": [2004, 2014, 2024, 2034, 2044, 2054, 2064, 2074, 2084, 2094, 2104, 2114],
"years_info0": [{
"year_char": "乙亥"
}, {
"year_char": "乙酉"
}, {
"year_char": "乙未"
}, {
"year_char": "乙巳"
}, {
"year_char": "乙卯"
}, {
"year_char": "乙丑"
}, {
"year_char": "乙亥"
}, {
"year_char": "乙酉"
}, {
"year_char": "乙未"
}, {
"year_char": "乙巳"
}, {
"year_char": "乙卯"
}, {
"year_char": "乙丑"
}],
"years_info1": [{
"year_char": "丙子"
}, {
"year_char": "丙戌"
}, {
"year_char": "丙申"
}, {
"year_char": "丙午"
}, {
"year_char": "丙辰"
}, {
"year_char": "丙寅"
}, {
"year_char": "丙子"
}, {
"year_char": "丙戌"
}, {
"year_char": "丙申"
}, {
"year_char": "丙午"
}, {
"year_char": "丙辰"
}, {
"year_char": "丙寅"
}],
"years_info2": [{
"year_char": "丁丑"
}, {
"year_char": "丁亥"
}, {
"year_char": "丁酉"
}, {
"year_char": "丁未"
}, {
"year_char": "丁巳"
}, {
"year_char": "丁卯"
}, {
"year_char": "丁丑"
}, {
"year_char": "丁亥"
}, {
"year_char": "丁酉"
}, {
"year_char": "丁未"
}, {
"year_char": "丁巳"
}, {
"year_char": "丁卯"
}],
"years_info3": [{
"year_char": "戊寅"
}, {
"year_char": "戊子"
}, {
"year_char": "戊戌"
}, {
"year_char": "戊申"
}, {
"year_char": "戊午"
}, {
"year_char": "戊辰"
}, {
"year_char": "戊寅"
}, {
"year_char": "戊子"
}, {
"year_char": "戊戌"
}, {
"year_char": "戊申"
}, {
"year_char": "戊午"
}, {
"year_char": "戊辰"
}],
"years_info4": [{
"year_char": "己卯"
}, {
"year_char": "己丑"
}, {
"year_char": "己亥"
}, {
"year_char": "己酉"
}, {
"year_char": "己未"
}, {
"year_char": "己巳"
}, {
"year_char": "己卯"
}, {
"year_char": "己丑"
}, {
"year_char": "己亥"
}, {
"year_char": "己酉"
}, {
"year_char": "己未"
}, {
"year_char": "己巳"
}],
"years_info5": [{
"year_char": "庚辰"
}, {
"year_char": "庚寅"
}, {
"year_char": "庚子"
}, {
"year_char": "庚戌"
}, {
"year_char": "庚申"
}, {
"year_char": "庚午"
}, {
"year_char": "庚辰"
}, {
"year_char": "庚寅"
}, {
"year_char": "庚子"
}, {
"year_char": "庚戌"
}, {
"year_char": "庚申"
}, {
"year_char": "庚午"
}],
"years_info6": [{
"year_char": "辛巳"
}, {
"year_char": "辛卯"
}, {
"year_char": "辛丑"
}, {
"year_char": "辛亥"
}, {
"year_char": "辛酉"
}, {
"year_char": "辛未"
}, {
"year_char": "辛巳"
}, {
"year_char": "辛卯"
}, {
"year_char": "辛丑"
}, {
"year_char": "辛亥"
}, {
"year_char": "辛酉"
}, {
"year_char": "辛未"
}],
"years_info7": [{
"year_char": "壬午"
}, {
"year_char": "壬辰"
}, {
"year_char": "壬寅"
}, {
"year_char": "壬子"
}, {
"year_char": "壬戌"
}, {
"year_char": "壬申"
}, {
"year_char": "壬午"
}, {
"year_char": "壬辰"
}, {
"year_char": "壬寅"
}, {
"year_char": "壬子"
}, {
"year_char": "壬戌"
}, {
"year_char": "壬申"
}],
"years_info8": [{
"year_char": "癸未"
}, {
"year_char": "癸巳"
}, {
"year_char": "癸卯"
}, {
"year_char": "癸丑"
}, {
"year_char": "癸亥"
}, {
"year_char": "癸酉"
}, {
"year_char": "癸未"
}, {
"year_char": "癸巳"
}, {
"year_char": "癸卯"
}, {
"year_char": "癸丑"
}, {
"year_char": "癸亥"
}, {
"year_char": "癸酉"
}],
"years_info9": [{
"year_char": "甲申"
}, {
"year_char": "甲午"
}, {
"year_char": "甲辰"
}, {
"year_char": "甲寅"
}, {
"year_char": "甲子"
}, {
"year_char": "甲戌"
}, {
"year_char": "甲申"
}, {
"year_char": "甲午"
}, {
"year_char": "甲辰"
}, {
"year_char": "甲寅"
}, {
"year_char": "甲子"
}, {
"year_char": "甲戌"
}]
},
"start_info": {
"jishen": ["太极", "太极 将星", "天德 金神 金舆 劫煞 孤辰 天喜", "太极 文昌 天厨 灾煞 桃花"],
"xz": "射手座",
"sx": "龙"
}
}
}