首页 黄历查询 黄历查询示例代码 黄历查询[PHP]

黄历查询示例代码[PHP]

作者: 阅读数:2074 上传时间:2016-03-10

黄历查询

<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$year = '2015';
$month = '10';
$day = '27';
$url = "https://api.jisuapi.com/huangli/date?appkey=$appkey&year=$year&month=$month&day=$day";
$result = curlOpen($url, ['ssl'=>true]);

$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));

if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}

$result = $jsonarr['result'];
echo $result['year'].' '.$result['month'].' '.$result['day'].' '.$result['yangli'].' '.$result['nongli'].' '.$result['star'].' '.$result['taishen'].' '.$result['wuxing'].' '.$result['chong'].' '.$result['sha'].' '.$result['shengxiao'].' '.$result['jiri'].' '.$result['zhiri'].' '.$result['xiongshen'].' '.$result['jishenyiqu'].' '.$result['caishen'].' '.$result['xishen'].' '.$result['fushen'].' '.implode(' ',$result['suici']).' '.implode(' ',$result['yi']).' '.implode(' ',$result['ji']).' '.$result['eweek'].' '.$result['emonth'].' '.$result['week'].'
';