Only sends part of the URL

Only sends part of the URL SearchSearch
Author Message
Peter Thompson
New member
Username: Ee8prt

Post Number: 14
Registered: 03-2004
Posted on Tuesday, November 02, 2004 - 08:25 am:   

Hi,

I wonder if anyone can help. I am using the nowsms system to send SMSs using the URL parameters.

The problem that I am having is that only part of the URL I am trying to send gets sent. I.e. if the full URL is http://www.test123.com/?_id=123, only www.test123.com gets sent.

I am guessing this is something to do with encoding special chars. in the URL, but I'm not sure how to do this?


Thanks,


Pete
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 3695
Registered: 10-2002
Posted on Wednesday, November 03, 2004 - 10:14 pm:   

Hi Pete,

Yes, when you're encoding URL parameters, some characters such as "?" and "&" and " " (space) can cause problems, because they are delimiters in an HTTP request, and either indicate the start of the next URL parameter or the end of the URL string (space).

Technically, any characters with a value above 0x7F (127) should also be URL escaped, but we are not as picky about that.

There's a chart of some of these URL escape sequences at:

http://www.nowsms.com/documentation/ProductDocumentation/sending_messages/sendin g_text_messages.htm

But I notice the "?" character is missing. It's code is "%3F". "&" is "%26". Space is either "+" or "%20". (This, of course, means that "+" must be escaped to "%2B".)

Taking your example above, the value that you want to pass in the URL parameter is:

www.test123.com/%3Fid=123

(The "http://" part is optional. Some HTTP libraries will choke on the ":" character in your URL paramters, and you may need to escape that as "%3A".)

-bn