LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-24-2012, 04:17 PM   #1
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Rep: Reputation: 29
convert a town, state into a zip code


I need a link to an open source PHP function that will allow me to enter the name of a town, state and get the zip code. That I can then send the result to a PHP proximity function for the surrounding towns.

I am finding plenty of code to convert a zip code into a town but nothing to convert a town in to a zip code.

Can anyone help?
TIA
Dave
 
Old 11-24-2012, 07:45 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Just a thought... If you found the code to convert from zip to town, then why not reverse engineer the code to do what you need it to do?
 
Old 11-24-2012, 09:55 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940Reputation: 3940
As far as I know you have to buy that information.
 
Old 11-24-2012, 10:02 PM   #4
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Rep: Reputation: 85
In my city, it has 15 different zip codes more or less. So just having the city and state alone may not be enough information.

This question has been asked and answered many times according to Google. One link I found using the Google Maps API,

http://www.wearehathway.com/blog/tec...oogle-maps-api

Others:

https://www.google.com/search?q=api+to+find+zip+code
 
Old 11-25-2012, 12:56 AM   #5
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Perhaps I need to explain what I want to happen.
Background:
I like to go see/hear independent musicians sing. House concerts, listening rooms. church outreach, and any other venue.
Recently I was in Cedar Creek Texas at house concert. Cedar Creek is a small community outside of Austin. Early afternoon timing over about 5. Since I was withing 20 minutes of Austin and 2.5 hours of home, I ask around who was playing in Austin I might want to see. No one, either musician or patron could tell me anything.

What I would like to make available:
Musician log on, enter date, city, state, name, their URL, venue URL or Email.

Me: go to website, type in date, city.
I would get back a listing of all playing on that date within a 60 mile range. Would looks something like this.
Code:
Dec. 8, 2912 La Grange TX Marcia Ball http://marciaball.com/  http://www.thebugleboy.org/
I would already know the zip for La Grange because I could find it if I were to plug it in into a proximity function using my zip and a 100 mile radius. But what if I was going to Bloomington Indiana and wanted to be sure there were tickets available.

I would seem to that for to work is finding all the zip codes.

Last edited by Dafydd; 11-25-2012 at 01:12 AM.
 
Old 11-25-2012, 01:10 AM   #6
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by corp769 View Post
Just a thought... If you found the code to convert from zip to town, then why not reverse engineer the code to do what you need it to do?
I've thought about that. My coding skills are not that strong. Though I may have to improve them.
 
Old 11-25-2012, 02:35 AM   #7
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
http://developer.yahoo.com/geo/geoplanet/
 
Old 11-26-2012, 01:50 AM   #8
Dafydd
Member
 
Registered: Oct 2008
Posts: 344

Original Poster
Rep: Reputation: 29
I have found HTML code that uses the < form > tag and returned zip codes for the town. But it displays it on their website.
I need to examine the source code to their website and see if I can glean enough information to be useful and not not infringe on any copyrights.

Code:
<form name="form1" method="post" action="http://www.zip-codes.com/search.asp" target="_blank">
<table border="0" cellpadding="2" cellspacing="0">
<tr align="center"><td colspan="2"><b>Find ZIP Code of a City</b></td></tr>
<tr><td>Town/City:</td>
<td><input name="fld-city" type="text" size="15"></td></tr>
<tr><td>State:</td>
<td><input name="fld-state" type="text" size="5" maxlength="2"></td></tr>
<tr><td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Search"></td></tr>
<tr align="center"><td colspan="2"><a href="http://www.zip-codes.com" target="_blank" title="Free ZIP Code Finder and ZIP Code Database">Provided by Zip-Codes.com </a></td>
</tr></table>
</form>

Last edited by Dafydd; 11-26-2012 at 01:53 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert a batch of 7z files to zip don_wombat_73 Linux - Newbie 5 07-04-2016 09:35 AM
have not been able to open are convert zip and rar files to something useable. rich2you Linux - Newbie 4 07-19-2012 02:11 PM
[SOLVED] Small matlab code to convert Morse code to plaintext using regular expressions gregorian Programming 3 03-31-2010 12:34 PM
Could someone convert a tar to zip? SkunkyMonkey General 4 02-07-2009 05:18 AM
pls convert this windows code into linux code nagendrar Programming 6 06-03-2008 07:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration