matlab URI can not access to a valid url webpage

조회 수: 2 (최근 30일)
Shan Su
Shan Su 2020년 7월 1일
답변: Rik 2020년 7월 1일
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,

답변 (1개)

Rik
Rik 2020년 7월 1일
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);

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by