matlab URI can not access to a valid url webpage

3 visualizzazioni (ultimi 30 giorni)
Shan Su
Shan Su il 1 Lug 2020
Risposto: Rik il 1 Lug 2020
Hi,
I tried to use URI to request and receive response from internet. However, it says "invalid url", while I'm pretty sure the url is correct (since I can access with web browser). I was thinking that the '|' character raised the problem.
Here is my url (I delete my key here):
Here is how I use the function.
r = RequestMessage;
uri = URI(http://maps.googleapis.com/maps/api/staticmap?center=Chicago&zoom=19&size=800x800&style=color:0x000000&style=feature:road|element:geometry|color:0xffffff&style=element:labels|visibility:off&key=XXXXXXXX);
resp = send(r,uri);
I also tried to replace '|' with '%7C', but URI cropped the string after '%'.
Thank you in advance,

Risposte (1)

Rik
Rik il 1 Lug 2020
You forgot to input the URI as a char array:
r = RequestMessage;
uri = URI('http://maps.googleapis.com/maps/api/staticmap?center=Chicago&zoom=19&size=800x800&style=color:0x000000&style=feature:road|element:geometry|color:0xffffff&style=element:labels|visibility:off&key=XXXXXXXX');
resp = send(r,uri);

Categorie

Scopri di più su Downloads in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by