It seems that curl works on my localhost but when I upload it to my server it stops working.
This is when i have it on localhost : And this is on the host provider server :
I am not a professional developer but i think there can be a problem with the host provider one.com
<?php
require 'kint/Kint.class.php';
$cURL = curl_init('162.243.44.4/server_list.json');
curl_setopt($cURL, CURLOPT_PORT, 3000);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$jsondata = curl_exec($cURL);
Kint::dump($jsondata);
$json = json_decode($jsondata, true);
function ping($host,$port=4000,$timeout=6)
{
$fsock = fsockopen($host, $port, $errno, $errstr, $timeout);
if ( ! $fsock )
{
return 'Offline';
}
else
{
return 'Online';
}
}
Kint::dump($json['servers']);
foreach ($json['servers'] as $js){
echo $js['name'] . ' is ' . ping($js['ip']) . ' <br>';
}
?>