{ "code": "10000", "charge": false, "msg": "查询成功", "result": { "showapi_res_code": 0, "showapi_res_error": "", "showapi_res_body": { "allNum": 7892, "allPages": 395, "contentlist": [{ "ct": "2016-05-30 16:30:27.242", "id": "574bfa236e36c1d5f9289678", "img": "http://www.zbjuran.com/uploads/allimg/160530/2-160530145631924.gif", "title": "要不要来个鸳鸯戏水呢", "type": 3 }, { "ct": "2016-05-30 16:30:27.239", "id": "574bfa236e36c1d5f9289677", "img": "http://www.zbjuran.com/uploads/allimg/160530/2-160530151R09B.gif", "title": "翻滚的美少女", "type": 3 }], "currentPage": 1, "maxResult": 20, "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/showapi/dtgxt?page=1&maxResult=20&appkey=您申请的APPKEY'; } /** * 获取结果 * @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/showapi/dtgxt?page=1&maxResult=20&appkey=您申请的APPKEY" ) 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)) }