https://openapibox.com/api/postcodeapi/YOUR-API-KEY/getInfo?country_code=BD&postal_code=1000&place_name=Dhaka&admin_name1=Dhaka+Division&accuracy=0.95&latitude=25.2669&longitude=55.2934&limit=100
<?php
$endpoint = 'https://openapibox.com/api/postcodeapi/YOUR-API-KEY/getInfo';
$params = [
'country_code' => 'BD',
'postal_code' => '1000',
'place_name' => 'Dhaka',
'admin_name1' => 'Dhaka Division',
'accuracy' => 0.95,
'latitude' => 25.2669,
'longitude' => 55.2934,
'limit' => 100
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $endpoint,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'cURL error: ' . curl_error($curl);
} else {
echo htmlentities($response);
}
curl_close($curl);
?>
<?php
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client();
$endpoint = 'https://openapibox.com/api/postcodeapi/YOUR-API-KEY/getInfo';
$params = [
'country_code' => 'BD',
'postal_code' => '1000',
'place_name' => 'Dhaka',
'admin_name1' => 'Dhaka Division',
'accuracy' => 0.95,
'latitude' => 25.2669,
'longitude' => 55.2934,
'limit' => 100
];
try {
$response = $client->post($endpoint, [
'form_params' => $params
]);
echo htmlentities($response->getBody());
} catch (RequestException $e) {
echo 'Guzzle error: ' . $e->getMessage();
}
?>
const endpoint = 'https://openapibox.com/api/postcodeapi/YOUR-API-KEY/getInfo';
const params = {
country_code: 'BD',
postal_code: '1000',
place_name: 'Dhaka',
admin_name1: 'Dhaka Division',
accuracy: 0.95,
latitude: 25.2669,
longitude: 55.2934,
limit: 100
};
async function fetchApiData() {
try {
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams(params).toString(),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.text();
console.log(data);
} catch (error) {
console.error('Fetch error:', error);
}
}
fetchApiData();
import requests
endpoint = 'https://openapibox.com/api/postcodeapi/YOUR-API-KEY/getInfo'
params = {
'country_code': 'BD',
'postal_code': '1000',
'place_name': 'Dhaka',
'admin_name1': 'Dhaka Division',
'accuracy': 0.95,
'latitude': 25.2669,
'longitude': 55.2934,
'limit': 100
}
try:
response = requests.post(endpoint, data=params)
if response.status_code == 200:
print(response.text)
else:
print(f"HTTP error: {response.status_code}")
except requests.RequestException as e:
print(f"Request error: {e}")
package main
import (
"bytes"
"fmt"
"net/http"
"net/url"
)
func main() {
// Define the API endpoint
endpoint := "https://openapibox.com/api/postcodeapi/YOUR-API-KEY/getInfo"
// Define the parameters
params := url.Values{}
params.Add("country_code", "BD") // Optional: Country code (e.g., 'BD' for Bangladesh)
params.Add("postal_code", "1000") // Optional: Postal code (e.g., '1000' for Dhaka)
params.Add("place_name", "Dhaka") // Optional: Place name (e.g., 'Dhaka')
params.Add("admin_name1", "Dhaka Division") // Optional: Admin name (e.g., 'Dhaka Division')
params.Add("accuracy", "0.95") // Optional: Accuracy (e.g., '0.95')
params.Add("latitude", "25.2669") // Optional: Latitude (e.g., '25.2669')
params.Add("longitude", "55.2934") // Optional: Longitude (e.g., '55.2934')
params.Add("limit", "100") // Optional: Limit of records to return (default 100)
// Create a new POST request
req, err := http.NewRequest("POST", endpoint, bytes.NewBufferString(params.Encode()))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
// Set headers
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
// Send the request using the http.Client
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
// Read and display the response
buf := new(bytes.Buffer)
buf.ReadFrom(resp.Body)
fmt.Println(buf.String())
}