{ "code": 200, "msg": "success", "data": { "current_page": 1, "data": [{ "title": "秦观酒兴大发·下楼格--打一诗词句", "content": "秦观酒兴大发·下楼格", "answer": "多少游春意", "type": "shiwenmiyu", "type_name": { "type": "shiwenmiyu", "name": "诗文谜语", "desc": "顾名思义,诗文迷指猜诗文的谜语" } }], "first_page_url": "https://v1.alapi.cn/api/riddle?page=1", "from": 1, "last_page": 574, "last_page_url": "https://v1.alapi.cn/api/riddle?page=574", "next_page_url": "https://v1.alapi.cn/api/riddle?page=2", "path": "https://v1.alapi.cn/api/riddle", "per_page": 10, "prev_page_url": null, "to": 10, "total": 5731 }, "Author": { "name": "Alone88", "desc": "由Alone88提供的免费API 服务,官方文档:www.alapi.cn" } }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2020/02/01 00:16 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'https://v1.alapi.cn/api/riddle'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "https://v1.alapi.cn/api/riddle" ) 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)) }