How to mirror api result using file_get_contents but the output is pretty

558fe5180e0e8fc922d31c23ef84d240

Hello everone my name is reidho i have a problem with my code, i want to mirroring a api output from somesite using file_get_contents but the results is not like the original.

Original Result :
original.png
My Mirroring Result :
result.png
The Code :

$ping = "https://api.hackertarget.com/nping/?q=8.8.8.8";
$pingkeluar   = file($ping);
foreach ($pingkeluar as $pingnya) {
echo " $pingnya ";
}