This API provides location data for Divisions, Districts, Upazilas, Unions, and Villages in Bangladesh.
All API requests must include the following headers:
X-API-KEY: YOUR_API_KEY
X-API-DOMAIN: YOUR_DOMAIN_NAME
X-API-DOMAIN.
GET /makobir.com.bd/bdgeo/get/divisions
GET /makobir.com.bd/bdgeo/get/districts/{division_id}
GET /makobir.com.bd/bdgeo/get/upazilas/{district_id}
GET /makobir.com.bd/bdgeo/get/unions/{upazila_id}
GET /makobir.com.bd/bdgeo/get/villages/{union_id}
[
{
"id": 1,
"name_en": "Dhaka",
"name_bn": "ঢাকা"
},
...
]
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://makobir.com.bd/bdgeo/get/divisions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-KEY: YOUR_API_KEY',
'X-API-DOMAIN: yourdomain.com'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
import requests
headers = {
'X-API-KEY': 'YOUR_API_KEY',
'X-API-DOMAIN': 'makobir.com.bd'
}
response = requests.get('https://makobir.com.bd/bdgeo/get/divisions', headers=headers)
data = response.json()
print(data)
const fetch = require('node-fetch');
fetch('https://makobir.com.bd/bdgeo/get/divisions', {
headers: {
'X-API-KEY': 'YOUR_API_KEY',
'X-API-DOMAIN': 'makobir.com.bd'
}
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error('Error:', err));
Each response object contains:
name_en - English namename_bn - Bangla nameA WordPress plugin for Bangladesh location selection with dependent dropdowns that works with popular form plugins.
BDGeo Locations → SettingsThe simplest way to use the plugin:
[bdgeo_location_selector]
This will show all available location fields (Division, District, Upazila, Union, Village).
When submitted, the form will include these fields for each level:
| Field Name | Description | Example Value |
|---|---|---|
division |
Selected division ID or name (based on format) | 3 or ঢাকা |
division_id |
Always contains the division ID | 3 |
division_name |
Name in current language setting | ঢাকা or Dhaka |
division_name_bn |
Always contains Bangla name | ঢাকা |
division_name_en |
Always contains English name | Dhaka |
Specify which fields to display:
[bdgeo_location_selector fields="division,district,upazila"]
Available fields: division, district, upazila, union, village
To submit location names instead of IDs:
[bdgeo_location_selector name_format="name"]
[bdgeo_location_selector fields="division,district" name_format="name"]
Simply add the shortcode to your form:
<div class="bdgeo-fields">
[bdgeo_location_selector fields="division,district"]
</div>
Add an HTML field and insert the shortcode:
<div class="ginput_container">
[bdgeo_location_selector fields="division,district,upazila"]
</div>
Use the HTML field to add the shortcode:
<div class="wpforms-field">
[bdgeo_location_selector]
</div>
Here's how to handle the submitted data in PHP:
// Get the submitted data
$division_id = sanitize_text_field($_POST['division_id']);
$division_name = sanitize_text_field($_POST['division_name']);
$division_name_bn = sanitize_text_field($_POST['division_name_bn']);
$division_name_en = sanitize_text_field($_POST['division_name_en']);
// Store in database
$location_data = [
'division_id' => $division_id,
'division_name' => $division_name,
'division_name_bn' => $division_name_bn,
'division_name_en' => $division_name_en,
// Repeat for other levels
];
// Display based on current language
$current_lang = get_option('bdgeo_language', 'bn');
$display_name = ($current_lang === 'bn') ? $division_name_bn : $division_name_en;
echo "Selected Division: " . esc_html($display_name);
Go to BDGeo Locations → Settings and select your preferred language (English or Bangla).
Check that:
Yes! Add this CSS to your theme:
#bdgeo-location-wrapper select {
padding: 8px;
border-radius: 4px;
border: 1px solid #ddd;
margin-right: 10px;
margin-bottom: 10px;
min-width: 200px;
}
name_format="name" parameter if you need to display the submitted values directly without database lookups.
If you need help or want to request access, please contact: hello@makobir.com.bd