This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

replacement in tcl script

Old posts that have not been replied to for several years.
Locked
w
why

replacement in tcl script

Post by why »

hi all,

just a question:

how can i replace this things

in tcl script i have this

Code: Select all

puts $sock "GET http://www.domain.com/test.php?where=$place"
if i run
.whereis New%York (please notice that %)
everything running fine.

but if i try it with
.whereis New York (without %)

bot hangs on..

can someone help with this little problem.

thank you in adv.

cheers
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This is because you need to URL escape the string.

Allthough in most cases, webbrowsers seem to post strings with the space in, they don't.

Take a look at the Tcl provided http package. It will do 2 things for you.

1: Will likely save you one hell of a time, in writting a download client, when Tcl allready provides one.

2: Has an escape function allready, and will help you in escapeing the URL.

The docs for this are located at http://www.tcl.tk/man/tcl8.3/TclCmd/contents.htm

See your Tcvl lib directory for the package.
Locked