Strings as URL Parameters

Dave Cragg dcragg at lacscentre.co.uk
Tue Nov 25 04:38:00 EST 2003


At 12:50 am -0800 25/11/03, Dan Shafer wrote:
>What is the best way to attach a string as a parameter to a URL so
>that it gets sent in its entirety and isn't surrounded by quotation
>marks on the receiving end?

First thing, Dan, are you using the most recent version of libUrl 
(1.0.13). This is the version that shipped with Rev 2.1.2. If you're 
using an older version of Rev, you can get the libUrl update here:

<http://www.runrev.com/revolution/developers/interimreleases/liburl/releases.shtml>

It contains some changes to the url parsing routines that might be 
significant for urls like the one you are using.

>
>I have a URL that looks sort of like:
>
>http://www.sitename.com/cgi-name?command@user:pwd@location!filename=test2.txt&text="This 
>
>is some text"
>
>Typed into a browser, it works perfectly.
>
>Run from Revolution, only the first word of the text string appears
>as a value in file being created on the server.

The server won't like spaces in the text string, so you'll need to 
urlEncode that part.E.g.:

put 
"http://www.sitename.com/cgi-name?command@user:pwd@location!filename=test2.txt&text=" 
into tUrl
put urlEncode("This is some text") after tUrl
get url tUrl
etc.

By the way, should the "!filename" not be "&filename"?

Cheers
Dave


More information about the use-livecode mailing list