{ "resultcode": "200", "reason": "Success", "result": { "data": [{ "title": "向诸葛亮借智慧", "catalog": "历史 心理学 管理 ", "tags": "一本好书 三国历史 社会学好书推荐 管理书籍推荐 诸葛亮 ", "sub1": "《向诸葛亮借智慧》", "img": "http://apis.juhe.cn/goodbook/img/379cdafe13f92d62e99388182a6d08ec.jpg", "reading": "8091人阅读", "online": "京东商城:http://book.jd.com/10483893.html 当当网:http://product.dangdang.com/product.aspx?product_id=21020821 苏宁易购:http://www.suning.com/emall/prd_10052_22001_-7_1006212_.html ", "bytime": "2013年4月28日" }], "totalNum": "9", "pn": 0, "rn": "1" } }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2020/09/05 16:46 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'http://zhouxunwang.cn/data/?id=64&key=R5RTF4G5F5H&catalog_id=242&pn=10&rn=20'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "http://zhouxunwang.cn/data/?id=64&key=R5RTF4G5F5H&catalog_id=242&pn=10&rn=20" ) 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)) }