支持格式:application/x-www-form-urlencoded
请求方式:HTTP GET/POST
请求示例:
//您的密钥
$api_secret = "wD******XhOUW******pvr";
//请求择日择时接口
$gateway_host_url = "https://doc.yuanfenju.com/liupan/meihua.html";
//请求参数
$request_data = [
'api_key' => $api_secret,
'born_year' => '1999', //公历出生年
'pan_model' => '3', //起卦方式 例:1:自动起卦 2:自选时间 3:终身卦 4:手工指定 5:数字起卦
'year' => '1990',
'month' => '5',
'day' => '23',
'hours' => '8',
'minute' => '52',
'sex' => '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);
}