Probably the easiest method would be to use something like the Google geocoding API . He will take the string and try to parse it into place. You can get output like XML, JSON, CSV.
Here is an example of CSV output:
input : gaborone, botswana output: 200,4,-24.6541100,25.9087390 input : #siliconcape output: 602,0,0,0 input : 40.75,-73.997 output: 200,8,"324 W 30th St, New York, NY 10001, USA"
source share