Many classifieds sites request a user's zipcode to narrow content results to the user's region or metro area. (e.g. I type in 37803
and get Knoxville, TN
, the appropriate metro region for Maryville, TN. Think Craigslist.) How does one go about getting such results with (U.S.) zip code only?
I'm assuming the answers will be some API's to query. I've found sites that will return an HTML page with the exact city, but I'm hoping to find something that A) will return JSON, XML or text data vs. HTML, and B) will return the nearest or encompassing metro.
Actually, that ZIP code belongs to Maryville, TN.
You can try an API like LiveAddress. (Note: I used to work at SmartyStreets.)
The API calls are simple enough:
Here's the response:
For low-volume usage, it's a free service.