金口诀排盘 api接口

本文介绍了如何使用PHP通过Yuanfenju的接口平台调用择日择时服务,详细展示了POST请求参数和使用curl发送请求的方法,返回了包含命理解析结果的数据结构。
摘要由CSDN通过智能技术生成

接口平台: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 needed
        echo "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秒"
		}
	}
}

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值