Website/tfinfo/index.php
2020-07-17 21:10:49 -07:00

32 lines
No EOL
521 B
PHP

<?php
set_time_limit(0);
function downloadfile()
{
$options = array(
CURLOPT_TIMEOUT => 5,
CURLOPT_URL => "http://play.totalfreedom.me:28966/players",
CURLOPT_RETURNTRANSFER => true
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
curl_close($ch);
if ($result)
{
$fp = fopen("players.json", "w");
fwrite($fp, $result);
fclose($fp);
}
}
downloadfile();
$json = file_get_contents("players.json");
header("Content-Type: application/json");
echo $json;
?>