Strings as URL Parameters

Dan Shafer revdan at danshafer.com
Tue Nov 25 11:40:42 EST 2003


On Nov 25, 2003, at 1:38 AM, Dave Cragg wrote:

> 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.
>
Thanks for the heads-up. I have been lazy and not yet upgraded to  
2.1.2. I'll do that right away.

>>
>> 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.
>
Yeah, I figured that would work but I was trying to avoid it because it  
makes the file really funny to edit on the server side. I'll have to  
bypass the usual filesystem editing techniques and write a custom  
script on the server to decode the field before placing it into the  
editor there if I allow the user to edit the file directly on the  
server. For now, I'll finesse that by requiring the user always to  
access the file via the Rev app.

> By the way, should the "!filename" not be "&filename"?
>
Yep. Good catch.

I did get this all working about 1:30 a.m. today using the urlEncode  
approach, so I'm most of the way down the road for the first release of  
the project.

Thanks to you and Jan Schenkel for the clue!

> Cheers
> Dave
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the Use-livecode mailing list