接口地址:https://zj.v.api.aa1.cn/api/Age-calculation/ |
---|
返回格式:json |
请求方式:get |
请求示例:https://zj.v.api.aa1.cn/api/Age-calculation/?birthday=2000-01-01 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
birthday | string | 必填 | 年龄格式:2000-01-01 |
名称 | 类型 | 说明 |
---|---|---|
age | string | 年龄 |
animal | string | 生肖 |
constellation | string | 星座 |
{
"code": "200",
"msg": "年龄计算",
"age": 23,
"animal": "龙",
"constellation": "摩羯座"
}
错误码 | 说明 |
---|---|
- | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2023/03/07 22:56
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://zj.v.api.aa1.cn/api/Age-calculation/?birthday=2000-01-01';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://zj.v.api.aa1.cn/api/Age-calculation/?birthday=2000-01-01"
)
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))
}