Skip to content

Commit

Permalink
Update Repeaters.php
Browse files Browse the repository at this point in the history
Changed to using curl over get_file_contents
  • Loading branch information
M0JGX authored May 2, 2023
1 parent 4a0fc60 commit 5ced6fb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Repeaters.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,24 @@
<tbody>

<?php
$json_data = file_get_contents("https://dvsph.net/api/Repeaters.json");
//Use CURL to get JSON file from DVSPH API Server
$ch = curl_init("https://dvsph.net/api/Repeaters.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$json_data = curl_exec($ch);
if(curl_exec($ch) === false)
{
//Error message if the JSON file can not be imported - Customise this with your own message if you wish
echo 'DV Scotland Phoenix Repeater live feed not available at this time';
}
curl_close($ch);

$data = json_decode($json_data, true);

$items = $data['Repeaters'];

foreach($items as $row){

//Set Variables - some are taken from RadioID.net
//Set Variables - some are taken from RadioID.net. Listed here for clarity personally would have just included the $row variables into the echo output.
$callsign = $row["callsign"];
$city = $row["city"];
$freq_output = $row["frequency"];
Expand Down

0 comments on commit 5ced6fb

Please sign in to comment.