{ "reason": "success", "result": { "year": 2020, /*农历年份数字*/ "month": 12, /*农历月份数字*/ "day": 3, /*农历日期数字*/ "Animal": "鼠", /*属相*/ "ImonthCn": "腊月", /*农历月份*/ "IDayCn": "初三", /*农历日期*/ "cYear": 2021, /*公历年份数字*/ "cMonth": 1, /*公历月份数字*/ "cDay": 15, /*公历日期数字*/ "gzYear": "庚子", /*干支纪年*/ "gzMonth": "己丑", /*干支纪月*/ "gzDay": "癸亥", /*干支纪日*/ "isLeap": false, /*是否闰月*/ "ncWeek": "星期五", /*周几*/ "isTerm": false, /*是否节气*/ "Term": null, /*节气,例:大寒,isTerm为true时不为null*/ "astro": "魔羯座", /*星座*/ "eightAll": { "eight": [ /*八字*/ "庚子", "己丑", "癸亥", "庚申" ], "shu": "水" /*属(如:属水)*/ }, "fiveAll": { "five": [ /*五行*/ "金水", "土土", "水水", "金金" ], "lose": "木火" /*缺(如:缺木火)*/ } }, "error_code": 0 }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2023/11/10 14:26 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'http://apis.juhe.cn/birthEight/query?key=key&year=1&month=1&day=1&hour=1'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "http://apis.juhe.cn/birthEight/query?key=key&year=1&month=1&day=1&hour=1" ) func main() { queryUrl := fmt.Sprintf("%s",APIURL) resp, err := http.Get(queryUrl) if err != nil { log.Println(err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) }