Hallo,
ich versuche JSON-Daten von nominatim.openstreetmap.org zu bekommen.
Mein Versuch:
Variablen:
VAR
Client : httpsClient;
Responsedata : STRING[1024];
END_VAR
PROGRAM _INIT
Client.method := httpMETHOD_GET;
Client.option := httpOPTION_HTTP_11;
Client.pHost := ADR('nominatim.openstreetmap.org');
Client.pUri := ADR('/search?q=Schanzenstrasse%2090,8500%20Hamburg&format=json&limit=1');
// Client.pRequestData := ADR('/search?q=Schanzenstrasse%2090,8500%20Hamburg&format=json&limit=1');
//Client.hostPort := 443;
Client.pResponseData := ADR(Responsedata);
Client.responseDataSize := SIZEOF(Responsedata);
END_PROGRAM
PROGRAM _CYCLIC
Client(enable := TRUE, send := TRUE); (* Call httpClient() *)
END_PROGRAM
PROGRAM _EXIT
(* Release Client instance *)
Client(enable := 0, send := 0);
END_PROGRAM
Das Ergebnis sollte so aussehen:
[
{
"place_id": 131168262,
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
"osm_type": "way",
"osm_id": 919748505,
"lat": "53.5642677",
"lon": "9.9655483",
"class": "highway",
"type": "tertiary",
"place_rank": 26,
"importance": 0.0534158869306477,
"addresstype": "road",
"name": "Schanzenstraße",
"display_name": "Schanzenstraße, Sternschanze, Altona, Hamburg, 20357, Deutschland",
"boundingbox": [
"53.5641072",
"53.5644280",
"9.9655052",
"9.9655919"
]
}
]
Aber ich bekomme nur ein 403: Access blocked