I’m using openstreet api but currently I’m running into an error where I’m getting 403 error. I’ve looked into the docs and it said to provide valid headers. I provided the headers but still I’m getting the same error.
"Client error: GET https://nominatim.openstreetmap.org/reverse?format=json&lat=32.2134&lon=76.2344
Here’s the code:
try {
$response = $client->request('GET', 'https://nominatim.openstreetmap.org/reverse', [
'query' => [
'format' => 'json',
'lat' => $latitude,
'lon' => $longitude
],
"headers" => [
'User-Agent' => 'MyApp/1.0 (https://myapp.dev.net; [email protected])',
'Referer' => 'https://myapp.dev.net'
]
]);
}
catch(RequestException $e) {
echo "AN ERROR OCCURED: ".$e->getMessage();
};
```