{ "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 }
<?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)) }