For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2004 > File upload and response with TclCurl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author File upload and response with TclCurl
Charlie Bursell

2004-10-20, 4:07 pm

Can I use ::curl::transfer to send a file to a Web Server and get a
response from that Web Server? For example I have an XML file that I
wish to send to an asp application, i.e, http://10.10.20.11/hisap.asp.
The web server then returns an Acknowledgement message indicating
whether he was happy with the message or not.

Something like: ::curl::transfer -url http://10.10.20.11/hisap.asp
-file myfile

returns 0. I need the response from the remote application.

On the same subject, do I have to send it as a file or can I send it
as a buffer from within my Tcl script?

Any help is appreciated
Andres Garcia

2004-10-21, 4:04 pm

charlie.bursell@quovadx.com (Charlie Bursell) wrote in message news:<ac45e772.0410200655.39a42a93@posting.google.com>...
> Can I use ::curl::transfer to send a file to a Web Server and get a
> response from that Web Server?


I am guessing the asp app will expect the file to be sent
as if you had been in a web page with a form and a submit
button, in that case you need to do something like this:


set fileContent "This is what we will send as if it was the content of a file"

curl::transfer -url http://10.10.20.11/hisap.asp -bodyvar ack -post 1
-httppost [list name "name" bufferName noFile.txt \
buffer $fileContent contenttype "text/plain"]
-httppost [list name "submit" contents "send"]

puts "Server acknowledgment:"
puts $ack
Charlie Bursell

2004-10-21, 8:57 pm

fandom@retemail.es (Andres Garcia) wrote in message news:<5d6e9670.0410210446.724ff95@posting.google.com>...
> charlie.bursell@quovadx.com (Charlie Bursell) wrote in message news:<ac45e772.0410200655.39a42a93@posting.google.com>...
>
> I am guessing the asp app will expect the file to be sent
> as if you had been in a web page with a form and a submit
> button, in that case you need to do something like this:
>
>
> set fileContent "This is what we will send as if it was the content of a file"
>
> curl::transfer -url http://10.10.20.11/hisap.asp -bodyvar ack -post 1
> -httppost [list name "name" bufferName noFile.txt \
> buffer $fileContent contenttype "text/plain"]
> -httppost [list name "submit" contents "send"]
>
> puts "Server acknowledgment:"
> puts $ack


Actually, believe it or not, they just want the message (XML) and they
will then send back a response (XML). Perhaps -bodyvar is what I
need. I had attempted to use -writeproc. That works well as long as
everything is at the global level. But as soon as I try to work
inside a namespace, I get the message "Failed writing body".

Thank you for your help
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com