
       <?php
       $api_url = 'http://117.240.62.146/iiislifelineobapi/srvBkAPI.asmx/getDepartment';

       
// Get the XML response from the API
$arrContextOptions=array(
    "ssl"=>array(
          "verify_peer"=>false,
          "verify_peer_name"=>false,
      ),
  );
$jsonData = file_get_contents($api_url, false, stream_context_create($arrContextOptions));

print_r($jsonData);


// Decode the JSON string into a PHP array
$data = json_decode($jsonData, true);

if ($data === null) {
    // Handle JSON decoding error
    echo "JSON decoding error!";
} else {
    // Iterate through the array and access each item
    foreach ($data as $item) {
        $id = $item['Id'];
        $name = $item['Name'];
        
        // Use the extracted data as needed
        echo "ID: $id, Name: $name<br>";
    }
}

 





?>