In order to make Notepad++ auto-installer work on sourceforge, I need a script php which can determinate from where the connections come.
I don't need a precise location, only the continent is enough, so I can do such thing :
$baseAddr = "http://downloads.sourceforge.net/notepad-plus/npp.4.8.2.Installer.exe?use_mirror=";
$whichContinent = getRequestLocation(); // <== Function that I need
if ($whichContinent == ASIA)
$mirror = "nchc";
else if ($whichContinent == EUROPE)
$mirror = "dfn";
else if ($whichContinent == USA)
$mirror = "superb-west";
...
return $baseAddr.$minor;
What I try to do is to know the location of user, then make the download location point to the mirror near where user is.
Is anyone have such script?
Any help will be appreciated (by me, and of course, by all Notepad++ users :) )
Don
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In order to make Notepad++ auto-installer work on sourceforge, I need a script php which can determinate from where the connections come.
I don't need a precise location, only the continent is enough, so I can do such thing :
$baseAddr = "http://downloads.sourceforge.net/notepad-plus/npp.4.8.2.Installer.exe?use_mirror=";
$whichContinent = getRequestLocation(); // <== Function that I need
if ($whichContinent == ASIA)
$mirror = "nchc";
else if ($whichContinent == EUROPE)
$mirror = "dfn";
else if ($whichContinent == USA)
$mirror = "superb-west";
...
return $baseAddr.$minor;
What I try to do is to know the location of user, then make the download location point to the mirror near where user is.
Is anyone have such script?
Any help will be appreciated (by me, and of course, by all Notepad++ users :) )
Don
Don, no function exists for PHP. However there are a few alternatives. There are open source databases that allow this type of behavior.
Here are 2 links:
http://www.maxmind.com/app/geolitecountry
http://ip-to-country.webhosting.info/node/view/118
I've never actually used them, but it appears that the 2nd link would actually give u a good idea of what the function would hold.
-Brad
Here's a script that looks easy to use:
http://www.phptutorial.info/iptocountry/the_script.html
cheers,
o
Thank you for these links.
I'll check them.
Don