{ "code": "10000", "charge": false, "msg": "查询成功", "result": { "ret_code": 0, "ret_message": "", "ret_body": "[{\"level\":2,\"cat_id\":245,\"parent_cat_id\":239,\"cat_name\":\"衬衫\"},{\"level\":2,\"cat_id\":246,\"parent_cat_id\":239,\"cat_name\":\"T恤\"},{\"level\":2,\"cat_id\":248,\"parent_cat_id\":239,\"cat_name\":\"针织衫/毛衣\"},{\"level\":2,\"cat_id\":3848,\"parent_cat_id\":239,\"cat_name\":\"套装\"},{\"level\":2,\"cat_id\":5208,\"parent_cat_id\":239,\"cat_name\":\"民族服装\"},{\"level\":2,\"cat_id\":7281,\"parent_cat_id\":239,\"cat_name\":\"背心/马甲\"},{\"level\":2,\"cat_id\":7282,\"parent_cat_id\":239,\"cat_name\":\"风衣\"},{\"level\":2,\"cat_id\":7283,\"parent_cat_id\":239,\"cat_name\":\"夹克\"},{\"level\":2,\"cat_id\":7284,\"parent_cat_id\":239,\"cat_name\":\"棉裤\"},{\"level\":2,\"cat_id\":7285,\"parent_cat_id\":239,\"cat_name\":\"羽绒裤\"},{\"level\":2,\"cat_id\":7286,\"parent_cat_id\":239,\"cat_name\":\"毛呢大衣\"},{\"level\":2,\"cat_id\":7287,\"parent_cat_id\":239,\"cat_name\":\"棉衣\"},{\"level\":2,\"cat_id\":7289,\"parent_cat_id\":239,\"cat_name\":\"牛仔裤\"},{\"level\":2,\"cat_id\":7290,\"parent_cat_id\":239,\"cat_name\":\"POLO衫\"},{\"level\":2,\"cat_id\":7291,\"parent_cat_id\":239,\"cat_name\":\"皮裤\"},{\"level\":2,\"cat_id\":7292,\"parent_cat_id\":239,\"cat_name\":\"皮衣\"},{\"level\":2,\"cat_id\":7294,\"parent_cat_id\":239,\"cat_name\":\"卫衣\"},{\"level\":2,\"cat_id\":7295,\"parent_cat_id\":239,\"cat_name\":\"休闲裤\"},{\"level\":2,\"cat_id\":7296,\"parent_cat_id\":239,\"cat_name\":\"西服/西裤\"},{\"level\":2,\"cat_id\":7297,\"parent_cat_id\":239,\"cat_name\":\"羽绒服\"}]", "ret_id": 132364028515357280 } }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2021/04/14 15:26 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'https://way.jd.com/TONGLI/GoodsCat?appkey=appkey&cat_id=0'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "https://way.jd.com/TONGLI/GoodsCat?appkey=appkey&cat_id=0" ) 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)) }