PhP progarm for postal code

Discussion in 'PHP' started by Maria Adah, Apr 2, 2013.

  1. #1
    Hi,
    I am facing problem in getting postal for a ip address. I want to get the postal code for a ip address.
    Here more clear
    I am running HMA vpn on my computer. When I get a IP address from other side and postal code shown in HMA, but that postal code is not accurate.
    I need a program which can get the correct postal code.
    For example if i get IP address of NY, program return me the correct postal/zip code of that area.
    Hope you can understand what I am trying to say.
     
    Maria Adah, Apr 2, 2013 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    ThePHPMaster, Apr 5, 2013 IP
  3. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #3
    Maria, there are many API out there able to help you but believe me no one is going to return you the right ZIP/Post Code.

    You may also program in PHP a simple IP locator by using linux/php hosting and executing via shell a whois command that may return you something like this:
    ---

    Address: AddressHere
    City: CityHere
    StateProv: StateHere
    PostalCode: PostalCode Here

    ---

    So using a bit of regular expressions you will be able to take what's between PostalCode: and \n, using trim() to remove extra white spaces... and the PostalCode will be right there inside an array.

    Hope this make sense too.
     
    YoGem, Apr 6, 2013 IP
  4. Maria Adah

    Maria Adah Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #4
    Dear YoGem you are right. can I do this with my local host just after import the post code information data in my local data base?
     
    Maria Adah, Apr 7, 2013 IP
  5. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #5
    Dear Maria, you can do it live or using a DB. If you will let me know more about your project maybe I will be able to help you further.
     
    YoGem, Apr 7, 2013 IP
  6. Maria Adah

    Maria Adah Greenhorn

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #6
    As I told you I am using HMA for proxy. I need right postal code for enter data fields.
     
    Maria Adah, Apr 7, 2013 IP