Friday, 12 September 2014

XML Output Shows Side-By-Side



I have a geolocation api that works using XML, here's example: http://ift.tt/WTKKXG


I used this XML api on my website so I make a geo-location scanner, but for some reasons when it output, the IP/Country/Zip Code etc.. it shows side by side, which is confusing, my question is how to get the output to be below each other or in table.


My code:



<input type="text" name="username" style="text-align: center;" placeholder=" IP address" />
<input type="submit" name="submit" class="" value="Resolve" />


.`



if (isset($_POST['submit'])) {
$name = $_POST['username'];
$blacklist = array("100.100.100","123.123.123");
$ip = $_SERVER['REMOTE_ADDR'];
if(in_array($name,$blacklist))
{
echo "No";
else
$api1 = file_get_contents("http://ift.tt/WTKKXJ");
echo "<div style='display: block; color: red; font-weight: bold;>' $api1 </div>";


}
}

?>


That's how it looks: 31.44.188.50 NL Netherlands 07 Noord-Holland Amsterdam 52.35 4.9167


That's how I want it:



  • IP address: 31.44.188.50

  • Country: NL Netherlands

  • City: Noord-Holland Amsterdam


etc


No comments:

Post a Comment