Writing File or Registry Entry to Local HD

Discussion in 'PHP' started by WPPJames, Feb 3, 2011.

  1. #1
    I'm pretty sure the answer to this question will be "No", but if so, perhaps I can get suggestions for a alternate solution.

    Basically, I need to use geo-targeting within a software installer program I use. The installer does not have this capability built in. It does allows the setting of a variable based on a registry entry or the existense of a file on the user's hard drive. My idea was to have the installer first call a php page on my server that contains code like:

    <?php
    include("geoip.inc");
    $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD);
    $cocode = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
    geoip_close($gi);
    // Write $cocode value to registry on user's hard drive
    // OR
    // Create file on user's hard drive with $cocode value
    ?>
    Code (markup):
    Then my installer could either check for the registry entry or local file on the user's hd and use that to set a variable that I could use for decision making thru out the rest of the install routine.

    Any way this can be done? If not, any suggestions? Other than using a different installer package.
     
    WPPJames, Feb 3, 2011 IP
  2. moads

    moads Member

    Messages:
    115
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    What language are you writing your program in? I've done this in VB before.. you just need to use a winsock control to call the PHP script and collect the output.
     
    moads, Feb 3, 2011 IP
  3. WPPJames

    WPPJames Well-Known Member

    Messages:
    281
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    153
    #3
    Hey moads,

    Thanks for the reply. The apps I'm installing are actually 3rd party self-installing .exe's. I need to know the geo-location before I run them. If the user is "US" I'll execute one 3rd party file, if they are from a different country I'll execute a different one. I suppose I could create a stand alone .exe utility that did nothing but get the geo-location and record / store it somehow for use by the installer, but I'm hoping for something simpler.
     
    WPPJames, Feb 3, 2011 IP