接口平台:https://api.yuanfenju.com
开发文档:https://doc.yuanfenju.com/liupan/jinkoujue.html
支持格式:Form-data
请求方式:HTTP POST/GET
<?php//您的密钥
$api_secret = "wD******XhOUW******pvr";
//请求择日择时接口
$gateway_host_url = "https://api.yuanfenju.com/index.php/v1/Liupan/jinkoujue";//请求参数
$request_data = ['api_key' => $api_secret,'born_year' => 2005, //出生年'year' => 1996, //起盘年'type' => 1, //历类型 0农历 1公历'month' => 12,'day' => 23,'hours' => 8,'minute' => 37,'sex' => 0,'name'=>'张三','zhen' => 1, //是否真太阳时 例:1:考虑真太阳时 2:不考虑真太阳时'province' => '北京市','city'=>'北京','jiang_model' => 0,//换将方式 例:0:交节换将 1:中气换将'gui_model' => 1, //贵人方式 例:0:甲羊戊庚牛 1:甲戊庚牛羊'gui_xing_model' => 2, //贵人行运 例:0:夜 1:昼 2:自动卯酉分'difen_model' =>3, //地分方式 例:1:选定 2:报数 3:随机数'hang_year' => 1, //是否排行年 例:0:否 1:是
];//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);curl_setopt($ch, CURLOPT_FAILONERROR, true); // Set this option to handle errors$response = curl_exec($ch);if ($response === false) {$error_message = curl_error($ch);// Handle or output the error message as neededecho "cURL error: " . $error_message;}curl_close($ch);return $response;
}function process_host($curlPost,$gateway_url) {$response = curlSend($gateway_url,$curlPost,1);print_r($response);}process_host($request_data,$gateway_host_url);
返回数据:
{"errcode": 0,"errmsg": "请求成功","notice": "本次测算结果仅供娱乐使用,请勿用于封建迷信和违法用途。","data": {"name": "张三","sex": "乾造","gongli": "1996年12月23日08时22分","nongli": "1996年冬月十三日辰时","jieqi": "1996年12月07日04时14分大雪","xunkong": "辰巳","kongwang": "水空","yuejiang": "丑将","hangnian": "乙巳","nianming": "乙酉","shensha": {"guiren": "丑、未","rilu": "寅","yima": "申","taohua": "卯"},"sizhu_info": {"year_gan": "丙","year_zhi": "子","month_gan": "庚","month_zhi": "子","day_gan": "甲","day_zhi": "午","hour_gan": "戊","hour_zhi": "辰"},"pan_info": {"renyuan_info": {"ganzhi": "丁","shuaiwang": "死"},"guishen_info": {"ganzhi": "庚午","name": "朱雀","shuaiwang": "死","yongyao": ""},"jiangshen_info": {"ganzhi": "甲子","name": "神后","shuaiwang": "旺","yongyao": "用爻"},"difen_info": {"ganzhi": "卯","shuaiwang": "相"}},"zhen": {"province": "北京市","city": "北京","jingdu": "116.46","weidu": "39.92","shicha": "晚0小时14分10秒"}}
}