Menu

Need a php script for Npp auto-updater

Don HO
2008-03-10
2012-11-13
  • Don HO

    Don HO - 2008-03-10

    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

     
    • Nobody/Anonymous

      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

       
    • o_z

      o_z - 2008-03-10

      Here's a script that looks easy to use:
      http://www.phptutorial.info/iptocountry/the_script.html

      cheers,
      o

       
    • Don HO

      Don HO - 2008-03-12

      Thank you for these links.
      I'll check them.

      Don