IP to Location script

Started on the old forum in January 2012 · view the original in the archive · old links redirect here

6 replies · 743 views · started 14 years ago · 1 min read

4 participants
mFreak Developer · 66 posts #1

For all those who cant import those large tables for geo locating. I made this grabber. it uses curl and fetch results from remote server. Script returns array with country name, link to country flag and country shorthand name ( information is based on user IP).

// use it like this
$array = require 'path/to/geoip_curl.php';

//country name
$name = $array['NAME'];

//country flag
$flag_url = $array['IMG'];

//short name
$abbr = $array['ABBR'];

//show results
echo 'Country: ' . $name . "[$abbr]";
echo "<img src='{$flag_url}' />";

NOTE: I dont know for how long will this script work.

I tested it on my PC and phone and it shows correct results. I hope that it helps someone.

$("#mfreak").find(".head brain").clone();

Progress:

[|||___________________________] : 5%

Output:

Memory limit reached, unable to complete operation.

Support answer:

Try using a super uber strong mega computer to reach at least 10%.

👋

Attachments: geoip_curl.zip
hitman Junior · 31 posts #3

how to put it in profile in community site teach please?

slcash Developer · 75 posts #4

Wapxtech . , . When i am enter it. , . My result is unkown city and unknown cuntry . . .why that . Iam srilankan and location tangalle

mFreak Developer · 66 posts #5

slcash wrote: Wapxtech . , . When i am enter it. , . My result is unkown city and unknown cuntry . . .why that . Iam srilankan and location tangalle

demo wont show my location eather. at least my script showed me that i am browsing from bosnia.

$("#mfreak").find(".head brain").clone();

Progress:

[|||___________________________] : 5%

Output:

Memory limit reached, unable to complete operation.

Support answer:

Try using a super uber strong mega computer to reach at least 10%.

👋

wapxtech Developer · 189 posts #6

use geo.php, its maxmind geolocation =D they claim that they are the most reliable geoloc database, and for me its true. both of you tries geoloc.php, why dont you try geo.php? they have different api geoloc.php is a free api to geolocation database, thats why their database is not that reliable.

geo.php completes your needs, not only the geolocation but also the ISP =D

External image (may be gone) http://wapx.amob.com Applications, Games, Wallpapers, Ringtones, Videos, Themes, Screensaver and More!!!

mFreak Developer · 66 posts #7

wapxtech wrote: use geo.php, its maxmind geolocation =D they claim that they are the most reliable geoloc database, and for me its true. both of you tries geoloc.php, why dont you try geo.php? they have different api geoloc.php is a free api to geolocation database, thats why their database is not that reliable.

geo.php completes your needs, not only the geolocation but also the ISP =D

yep, its true maxmind is awesome. But for country and flag i stick to my grabber.

$("#mfreak").find(".head brain").clone();

Progress:

[|||___________________________] : 5%

Output:

Memory limit reached, unable to complete operation.

Support answer:

Try using a super uber strong mega computer to reach at least 10%.

👋

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close