接口地址:https://v2.alapi.cn/api/one |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://v2.alapi.cn/api/one?token=token |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
token | string | 必填 | 请求token 扫码关注公众号 |
date | string | 选填 | 日期,默认当天 |
名称 | 类型 | 说明 |
---|---|---|
title | string | 标题 |
content | string | 内容 |
{
"code": 200,
"msg": "success",
"data": {
"title": "娜拉(上)",
"subtitle": "心狗",
"content": "<p>灶上的高压锅到了时间.....<\/p>",
"cover": null,
"make_time": "2022-02-15 08:00:00"
},
"time": 1645509264,
"log_id": 354625319265054720
}
错误码 | 说明 |
---|---|
404 | 接口地址不存在 |
422 | 接口请求失败 |
400 | 接口请求失败 |
405 | 请求方法不被允许 |
100 | token 错误 |
101 | 账号过期 |
102 | 接口请求次数超过限制 |
104 | 来源或者ip不在白名单 |
406 | 没有更多数据了 |
429 | 请求 QPS 超过限制 |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://v2.alapi.cn/api/one",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "token=用户中心获取token&date=2021-04-21",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://v2.alapi.cn/api/one"
payload := strings.NewReader("token=用户中心获取token&date=2021-04-21")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}