Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am currently working on a PHP application that puts me in the desperate need of all the Countries, States and Cities in the world.
In the application, when you select a Country from the drop down menu, it loads up all the States in the selected Country into another drop down menu. When you then select a State from the newly generated drop down menu, it then loads up all the cities in the selected State into another drop down menu.
The challenge now is getting all the Countries, States and Cities. I have tried searching Google without results.
Am wondering if there is any PHP library or application that has all Countries, States and cities in it, so i can download and extend.
Thanks very much for your time.
A good place to start would be MaxMind PHP library which uses the freely available MaxMind.com database
there is GeoDataSource World Cities Database (Gold Edition) March.2010. This contains:
city database
latitude longitude
city latitude
cities database
world cities
global cities
world countries
distance calculator
state list
gazetteer
place names
populated places
GPS
and more, there is even a basic and premium package.
** EDIT
May not be worthwhile if your looking for something free however because the free package only offers city names. The basic package is
One Month - $149.95
One Year - $449.95
and the packages only get more expensive.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have reasearched a couple of options for MySQL & php search on the web and StackOverflow, but have not found something that really fits my scenario. Let me explain.
My scenario:
I have a table (TABLE1) in MySQL that has indexed terms (e.g. McDonalds, Microsoft, etc). This table has over 3000000 records.
I then have generic string that the user can enter - e.g. "There is a company called MCDonalds in my neighbourhood".
What i would like to look for occurances in the user entered string for any terms in my mysql table. I have implemented this currently by traversing each of the 3 million records in TABLE1 to see if it is in the user entered string (entered by user through a PHP page).
3 approach works 'well' - but of course it does not scale and the performance sucks :)
Any suggestion or pointers to algorithms to solve such a problem.. in a scalable and algorithmically sound way?
Thanks,
Joe
You should try MySQL's FULLTEXT search capability. Try something like this:
SELECT whatever, whatever
FROM TABLE1
WHERE MATCH(terms_column) AGAINST('There is a company called McDonalds in my neighbourhood')
You'll probably get lots of false positive matches, but this is an efficient way to at least narrow down the search.
It worked for me on a list of US cities matching against phrases like "Im going back to New Orleans to wear the ball and chain" and "Chicago, New York, Detroit and its all on the same street.".
You will need a FULLTEXT index on the your terms_column. And your table may, depending on the version of MySQL you're using, need to be in the MyISAM storage method.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I want the user to enter their full address including a dropdown list of countries and cities that are updated based on the country selected.
Do I really have to manual create a country database table as well as all possible cities table and then make a giant php check to match the two?
I am sure there is a smarter way of doing it, but I could not seem to find one!
Later I will be using the country and city to filter the results that are displayed on the page.
Any help is much appreciated!
search search search
goto http://www.geonames.org you can find complete list of cities in the world
In particular, you can search over the dump list.
Sql dump of all the Countries, Country Codes, Phone codes
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
(Please read patiently)
I am developing a application which searches for html documents based on keywords passed like : I want to buy a watch OR A watch for sale or etc. I have large list of html documents which contain these keywords but the problem I am currently facing is that I want to fetch only those docs who match best with the keywords. Suppose I am trying to find a post about selling a watch and tried with keyword : sell a watch this should bring the most relevant post which is actually selling a watch not with just contains selling word and watch word
You could ask what I have done so far : well I have done searching the documents with a simple PHP string search and this is doing just what I don't want to. I like to have natural search, Any third party API or Any idea could help a lot.
Note : I don't have the documents saved in the DB I am just pulling them up from Internet to my code and finding with keyword if they are relevant.
Thanks
Zend_Search_Lucene might help you. http://framework.zend.com/manual/1.12/en/zend.search.lucene.html
If you have the possibility to install a search engine on your server I would recommend Sphinx or ElasticSearch.
You coul also use some 3rd party search SAAS like (in no particular order):
http://www.indexden.com/
http://www.searchify.com/
http://www.found.no/
http://websolr.com/
https://swiftype.com/
https://searchbox.io/
http://www.houndsleuth.com/
http://www.bonsai.io/home
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I know that there are lists of country names in various languages available separately, but I would like to have a list of countries where each country is named how the inhabitants of the country call it. I mean the list like:
United States of America
Россия
Deutschland
I think it would be convenient for website visitors to choose the country name which they know well and also I won't have to store a separate country list for each language on the server - I can always display just this common list.
Is there such a list available on the Internet? Or maybe I can get it out of PHP somehow?
Take a look at the wikipedia article
list of countries and capitals in native languages.
also
list of country names in various languages.
http://www.omniglot.com/countries/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Where can I found the list of all the states of world with their country code (ISO2 or ISO3).
I have to insert all these states in my database. If the list is available in the .sql will be great.
I need state list of world with country-code not the country list.
Do you know where can I found?
Thanks in Advance.
http://www.timdavis.com.au/data/
There is a link to a excel spreadsheet of all the country and state information.
Wikipedia has the full list of both 2-letter and 3-letter country codes:
http://en.wikipedia.org/wiki/ISO_3166-1
With regards to having it in a local DB table, note that this list does occasionally change as nations are created, renamed or merged, so although it's not very frequent, you do need to keep it up-to-date, and also importantly, know what you're going to do with codes which become obsolete (ie if you've got cross-references to it from other tables, you can't just delete a record without making the cross-references invalid)
[EDIT]
You comment that you're looking for a state list.
This phrase "state list" is confusing. Are you using the word "state" as its used in the US. Other countries would refer to those as provinces, regions, counties, cantons, or a range of other terms.
More importantly, very few countries have codes for their individual regions.
For example, the UK is broken into counties such as Yorkshire, Hampshire and Surrey, but there aren't any codes that map to these names. There are short abbreviated versions of some of the names (ie 'Hants'=='Hampshire'), but they're colloquial abbreviations; certainly not official. There are also UK postcodes which do provide codes for areas, but these do not map to named counties. And other countries don't even have that.
This has annoyed me too. My issue is I can never find states to match countries. I created this for people to use. Its in YAML format, I generated python and javascript versions. I also generated an alternate array.
https://github.com/niall-oc/minimax
Search google for: php country abbreviations list
Here's the first link: http://27.org/isocountrylist/
http://www.timdavis.com.au/data/
Interesting data for Country & states.
Download excel from here correct the state names and import into your database and use.
You can get the SQL Scripts from this post:
SQL Scripts