matlab URI can not access to a valid url webpage

2 vues (au cours des 30 derniers jours)
Shan Su
Shan Su le 1 Juil 2020
Réponse apportée : Rik le 1 Juil 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,

Réponses (1)

Rik
Rik le 1 Juil 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);

Catégories

En savoir plus sur Downloads dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by