Search code examples
facebook-graph-apigeolocation

List of countries and cities to be used in Facebook Graph API for targeting


I am looking for a list of countries/states/cities that can be used with Facebook Graph API when publishing targeted posts.

I found one JSON file available on this page but the file doesn't parse correctly and I also doubt whether it can be used for post targeting since the file is for advertisements.

Also, I am not sure whether the third party data like the one provided by MaxMind can be used directly with Facebook API.

Does anyone have such a list or can atleast point me to a right direction?


Solution

  • Ok. I was able to use the same JSON file I mentioned in my question. As I said in my response to @offbysome, previously I had saved the file by opening it in Google Chrome. But then I used Firefox and used the Right Click => Save File As option to save the file on disk. This file is actually a tar gz (which facebook wrongly names as .php file). After unzipping the file, I was able to use the same code posted in my comment to get the PHP array which I then imported to MySQL.