MATLAB: Webwrite not send to right address

urlwebwrite

I am trying to send a request for data to
http://192.168.1.1/amp/query/BAND?
but for some reason, webwrite is cutting off the "?" is there anyway I can make sure it keeps the "?" there?
Using "?/" does not work and webread() does the same thing. Typing the url into a brower works perfectly fine but for matlab it gives an error saying
Error using readContentFromWebService
The Server returned the status 501 with message "Internal Server Error" in response to the request to URL http://192.168.1.1/amp/query/BAND.
Error in webwrite
[varargout{1:nargout}] = readContentFromWebService(connection,options);
Thank you, Tyler

Best Answer

I'm hardly an expert but it looks like your web server is not configured properly. A ? at the end of the URL, not followed by anything, should not matter, and matlab is probably right to strip it from the URL.
? is part of the reserved character set for URIs. When it's not used for its normal purpose as it would appear with your server, it must be percent encoded. So try:
http://192.168.1.1/amp/query/BAND%3F
Note: ? is normally used to separate the URI from the POST arguments. So it is normally followed by SOMEARG=VALUE&SOMEOTHERARG=SOMEOTHERVALUE
Related Question