我試圖從網站獲取json數據。在第一個鏈接中,它返回空白。 但在第二個,它返回json。如何從外部文件獲取有效的json?
有人知道我該怎麼做才能從第一個鏈接獲取json數據?
訪問之前這段代碼,請登錄在此鏈接: https://loginfree.globo.com/login/438 用戶:[email protected] 通:cartoletasfc
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<iframe src="http://cartolafc.globo.com/time/claudioivp-allianz/atletas.json?rodada_id=12"></iframe>
<?php
$file = json_decode(file_get_contents("http://cartolafc.globo.com/time/claudioivp-allianz/atletas.json?rodada_id=12"));
print_r($file);
echo "casa";
?>
<iframe src="http://cartolafc.globo.com/mercado/filtrar.json?page=1&order_by=preco&clube_id=277"></iframe>
<?php
$file = json_decode(file_get_contents("http://cartolafc.globo.com/mercado/filtrar.json?page=1&order_by=preco&clube_id=277"));
print_r($file);
echo "casa";
?>
</body>
</html>
對不起,我的答案,我讀了你的文章兩次,仍然沒有得到它。我顯然有一個糟糕的夜晚。 –
我仍然不明白爲什麼我們需要登錄到該網站。你知道PHP是服務器端,不能使用瀏覽器憑證嗎? aff tinha que ser desse cartolafc。 – Delta