Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: urlread passing special characters

Subject: urlread passing special characters

From: Michele

Date: 20 Feb, 2008 22:08:02

Message: 1 of 6

Help! I need to do a urlread with a GET method and a
parameter that contains slashes, eg.

urlread ('http://192.168.0.253', 'GET',
{'/goform/getdevicestatus', ''})

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!

Subject: Re: urlread passing special characters

From: Matthew Simoneau

Date: 20 Feb, 2008 22:30:04

Message: 2 of 6

URLREAD is encoding these because the GET needs to be a
valid URL. Shouldn't whatever's on the other end be
decoding these?

Subject: Re: urlread passing special characters

From: Michele

Date: 21 Feb, 2008 01:35:03

Message: 3 of 6

"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).



Subject: Re: urlread passing special characters

From: Matthew Simoneau

Date: 21 Feb, 2008 02:29:02

Message: 4 of 6

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')

Subject: Re: urlread passing special characters

From: Michele

Date: 21 Feb, 2008 18:09:01

Message: 5 of 6

"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).



Subject: Re: urlread passing special characters

From: Michele

Date: 21 Feb, 2008 18:28:01

Message: 6 of 6

"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 :-)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
special characters Michele 20 Feb, 2008 17:10:01
tcp Michele 20 Feb, 2008 17:10:01
packets Michele 20 Feb, 2008 17:10:01
urlread Michele 20 Feb, 2008 17:10:01
parameters Michele 20 Feb, 2008 17:10:01
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

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.
Related Topics