{ "reason": "查询成功!", "result": { "title": "美国男子职业篮球联赛", "duration": "2020-2021", "matchs": [{ "date": "2021-05-13", "week": "周四", "list": [{ "time_start": "07:00", "status": "3", "status_text": "完赛", "team1": "亚特兰大老鹰", "team2": "华盛顿奇才", "team1_score": "120", "team2_score": "116" }, { "time_start": "08:00", "status": "3", "status_text": "完赛", "team1": "布鲁克林篮网", "team2": "圣安东尼奥马刺", "team1_score": "128", "team2_score": "116" }, { "time_start": "08:00", "status": "3", "status_text": "完赛", "team1": "克里夫兰骑士", "team2": "波士顿凯尔特人", "team1_score": "102", "team2_score": "94" }, { "time_start": "09:00", "status": "3", "status_text": "完赛", "team1": "达拉斯独行侠", "team2": "新奥尔良鹈鹕", "team1_score": "125", "team2_score": "107" }, { "time_start": "09:30", "status": "3", "status_text": "完赛", "team1": "犹他爵士", "team2": "波特兰开拓者", "team1_score": "98", "team2_score": "105" } ] }] }, "error_code": 0 }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2022/01/03 19:08 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'http://apis.juhe.cn/fapig/nba/query?key=freeapi'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "http://apis.juhe.cn/fapig/nba/query?key=freeapi" ) 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)) }