{ "code": "10000", "charge": false, "msg": "查询成功", "result": { "ret_id": 132286366167045150, "ret_body": "[{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"毛呢大衣\",\"opt_id\":45},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"裤装\",\"opt_id\":52},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"套装\",\"opt_id\":305},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"羽绒服\",\"opt_id\":315},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"裙装\",\"opt_id\":485},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"T恤\",\"opt_id\":487},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"大码女装\",\"opt_id\":502},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"蕾丝雪纺衫\",\"opt_id\":557},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"棉服\",\"opt_id\":997},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"衬衫\",\"opt_id\":1001},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"牛仔裤\",\"opt_id\":1689},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"春季新品\",\"opt_id\":2701},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"针织毛衣\",\"opt_id\":2715},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"妈妈装\",\"opt_id\":3376},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"上衣外套\",\"opt_id\":4742},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"通勤装\",\"opt_id\":5105},{\"parent_opt_id\":14,\"level\":2,\"opt_name\":\"卫衣绒衫\",\"opt_id\":6168}]", "ret_message": "", "ret_code": 0 } }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2021/01/01 21:26 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'https://way.jd.com/TONGLI/GoodsOpt?opt_id=0&appkey=yourkey'; } /** * 获取结果 * @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/GoodsOpt?opt_id=0&appkey=yourkey" ) 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)) }