I happen to use worldweatheronline.com to get local weather.
Part of their API includes a city search API -- you give them a city name and they return the best matches for that name. For example you give them "Paris" it will give you back: "Paris, France", "Paris, TX" , etc. along with the latitude and longitude for each.
There are others available if you google for them.
Google has a similar API, but my understanding of their terms of use is you are only supposed to use that API if you are going to use it to display a point on a map -- since that isn't my usage model I went with something else.
There's a good sample webpage here:
http://stevemorse.org/jcal/latlon.php[
^]
which I found via google. He lists links to services he uses to get the data, and you can also look at the source code for the page.