After long time i finally got it.

$respon = array();

foreach (array_values($servers) as $id => $url) {
        $json = file_get_contents($url);
        // Converts it into a PHP object            
        $jsonBody = @json_decode($json, true);
        $status = $jsonBody["status"];
                        
    if($status=='1'){
       $respon[$id]= array("response"=>"$headers[0]","status"=>"Success","info"=>"Server $id is Live and Working Fine!");
        }else{
        $respon[$id]= array("response"=>"$headers[0]","status"=>"Failed","info"=>"Server $id is not Working!");
        }
    }

It was not easy for me as a beginner to think like this but I finally understand it correctly.

If anyone in future need help use it as a reference.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top