下面的代码不会在提供的URL中获取所有JSON内容,但是其中一部分,我找不到任何问题:
$json=file_get_contents("https://fantasy.premierleague.com/drf/bootstrap-static");
$data = json_decode($json, true);
var_dump($data);
答案 0 :(得分:1)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://fantasy.premierleague.com/drf/bootstrap static");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$jdecoded = json_decode($data, true);
curl_close($ch);
print_r($jdecoded);