is there a functionality in Facebook marketing api to get list of all cities in a region?

209 views Asked by At

I am currently able to get a list of all countries and a list of regions in one country (example : all states in US). How can I get a list of all cities in one region( example: all cities in Alabama).

This is how I am getting all the states in US:

$result = TargetingSearch::search(
            TargetingSearchTypes::GEOLOCATION,
            null,
            '',
            [
                'location_types' => ['region'],
                'country_code' => 'US',
                'limit' => 10000,
            ]);
        return $result;
1

There are 1 answers

0
PHP_Newbie On
$result = TargetingSearch::search(
            TargetingSearchTypes::GEOLOCATION,
            null,
            'alabama',
            [
                ''location_types' => ['city'],
            ]);
        return $result;

if we search by state_name(I have put alabama), and put location_types as city, we can get a list of all cities in that state.