Skip to content

Instantly share code, notes, and snippets.

@PyramisDev
Created September 25, 2013 05:44
Show Gist options
  • Save PyramisDev/6695563 to your computer and use it in GitHub Desktop.
Save PyramisDev/6695563 to your computer and use it in GitHub Desktop.
Country name and flag in php
Get Country
-----------
<?php
$country = file_get_contents('http://api.hostip.info/country.php?ip='.$_SERVER['REMOTE_ADDR']);
echo $country; //Remove this line
?>
Get Flag
--------
<IMG SRC="http://api.hostip.info/flag.php" width="30" height="20" BORDER="0" ALT="Your Choice">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment