The problem is that urlread translates the / (hex 2F) into
the 3 character string '%2F' in the actual TCP packet data
that gets sent out. This is similar to the problem I had
last year getting urlread to take base64 encoded passwords.
That one was solved by using
urlConnection.setRequestProperty. Unfortunately, I don't
know if I can do that in this case, or how to do it. I'm
not sure what "property" I might need to use.
So my question is, is there a way in Matlab to assemble a
TCP packet that includes special characters in the data?
Any and all help would be greatly appreciated. Thanks!
"Matthew Simoneau" <matthew@mathworks.com> wrote in message
<fpi9lc$fkh$1@fred.mathworks.com>...
> URLREAD is encoding these because the GET needs to be a
> valid URL. Shouldn't whatever's on the other end be
> decoding these?
That's really an excellent question. To avoid any
embarrassment to the manufacturer of the device I'm trying
to talk to, I'll refer to it simply as a "Frobniz 43" -
that's not its real name. (Its real name is the HRGZ-01
Z-Wave Gateway by Hawking Technology).
All I can tell you is that when I send an HTTP "get device
status" command to the Frobniz using the web client provided
by Hawking, the packet comes out as
'/goform/getdevicestatus' on the wire. When I try to
emulate that in Matlab using urlread, it comes out as
'%2Fgoform%2Fgetdevicestatus' and I get back an error
message from Matlab "Error downloading URL.".
The URL itself is valid, because I do get an appropriate
response when I do a plain urlread on the server without a
getdevicestatus request.
Considering the overall quality of the rest of their
software, its unlikely the Frobniz Corp. is going to repair
their reader, so my only other hope is to somehow coerce
Matlab into feeding the Gateway some data it would find more
palatable.
I'm sure this would be handy for other peoples' problems
too. Is there any workaround for this? Thanks (and thanks
again for your help on the last go-around too).
"Matthew Simoneau" <matthew@mathworks.com> wrote in message
<fpi9lc$fkh$1@fred.mathworks.com>...
> URLREAD is encoding these because the GET needs to be a
> valid URL. Shouldn't whatever's on the other end be
> decoding these?
That's really an excellent question. To avoid any
embarrassment to the manufacturer of the device I'm trying
to talk to, I'll refer to it simply as a "Frobniz 43" -
that's not its real name. (Its real name is the HRGZ-01
Z-Wave Gateway by Hawking Technology).
All I can tell you is that when I send an HTTP "get device
status" command to the Frobniz using the web client provided
by Hawking, the packet comes out as
'/goform/getdevicestatus' on the wire. When I try to
emulate that in Matlab using urlread, it comes out as
'%2Fgoform%2Fgetdevicestatus' and I get back an error
message from Matlab "Error downloading URL.".
The URL itself is valid, because I do get an appropriate
response when I do a plain urlread on the server without a
getdevicestatus request.
Considering the overall quality of the rest of their
software, its unlikely the Frobniz Corp. is going to repair
their reader, so my only other hope is to somehow coerce
Matlab into feeding the Gateway some data it would find more
palatable.
I'm sure this would be handy for other peoples' problems
too. Is there any workaround for this? Thanks (and thanks
again for your help on the last go-around too).
"Matthew Simoneau" <matthew@mathworks.com> wrote in message
<fpinle$e5l$1@fred.mathworks.com>...
> Maybe you don't want to send this as a parameter after all,
> but just as part of the URL. Does this work?
>
> >> urlread('http://192.168.0.253/goform/getdevicestatus')
Sigh... this is a perfect example of how sometimes you get
so hung up on complexities that you totally forget about the
obvious. (Putting on the Homer Simpson accent) "DOHHH!"
Yes, of course, that was it. That works fine. Thanks - I
owe you two now :-)
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.