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

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 ";
}