Grabbing IP address information
| From: | Jennifer | Date: | Tue, 14 Jan 2014 00:54:50 +0000 |
| Subject: | Grabbing IP address information | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-322686@lists.php.net to get a copy of this message | ||
Hi everyone!
My name's Jenni and I'm new to the list. I hope this question isn't too simple.
I want to grab some information about an IP address and present it in a readable fashion, so I
wrote the following:
$location = file_get_contents('http://freegeoip.net/json/78.18.200.182');
$location = str_replace('{', '', $location);
$location = str_replace('}', '', $location);
$location = str_replace('"', '', $location);
$location = str_replace(',', "\n", $location);
echo $location;
However, this seems longer than it needs to be. Is there a better way to do this?
Thank you,
Jenni
Superior Shelving Systems::::....
http://www.SuperiorShelving.com
The (Storage|Office|Display) Shelving Specialists
Since 1984
Computer Workstations:
http://www.superiorshelving.com/mfg/nexel/pages/lan-workstations-nexel.php