Thanks to everyone who responded on this.  I'm still stumped, but I think 
it's just a simple syntax question related to TCPClient.  I actually wasn't 
trying for multiple encodings in a single form post -- sorry for the confusion.

I simply want to post form data like this:

         [EMAIL PROTECTED]&Name=Osama&Action=Submit

But I still can't figure out the TCPClient syntax.  Here's what I have so far:

><cfset data = "[EMAIL PROTECTED]&Name=Osama&Action=Submit">
><cfset obj.SendRN("POST /myTest.cfm HTTP/1.0")>
><cfset obj.SendRN("Content-Type: application/x-www-form-urlencoded")>
><cfset obj.SendRN("Content-Length: #len(data)#")>
><cfset obj.SendRN("")>

But I'm not sure what to do with the data.  I suspect something like this:

><cfset obj.SendRN("RequestBody: #data#")>

but that doesn't work, and I'm not sure what other syntax to try.

The docs at www.coalesys.com (thanks Jon) showed Content-type & 
Content-length, but I couldn't figure out how to map their RequestBody into 
TCPClient.

Dave, I tried looking at a raw HTTP post with Microsoft's Web Application 
Stress Tool (which I happened to have handy), but it didn't show the actual 
form data:

>POST /myTest.cfm
>Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
>application/vnd.ms-powerpoint, application/vnd.ms-excel, 
>application/msword, */*
>Accept-Language: en-us,ja;q=0.5
>Content-Type: application/x-www-form-urlencoded
>User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
>Host: laptop.mgmtcourses.cognitivearts.com
>Content-Length: 61
>Pragma: no-cache
>Cookie: CFID=732; CFTOKEN=36216386

Maybe this is suppressing form data somehow?  I'll try Stretch later...

greg




At 02:22 PM 12/13/2001 -0500, lsellers wrote:
>At 12:39 PM 12/13/2001 -0600, you wrote:
> >OK, I'm learning about some of the pain referenced below ;-)
> >
> >I'm trying to perform an HTTP post operation, but I can't figure out how to
> >do it with TCPClient.  I know I need to change the method from GET to POST:
> >
> >          <cfset obj.SendRN("POST /myTest.cfm HTTP/1.0")>
> >
> >But I don't know how to set the form data.  Also, is it possible to use
> >multiple encoding types, like:
>
>Hmm... You would have to ask THAT question, eh?
>
>Fortunately, unless you're uploading binary data the payload/body of the
>http message is basically just standard url encoded data. Ie,:
>
>[EMAIL PROTECTED]&Name=Osama&Action=Submit
>
>etc. Otherwise you have to use MIME.
>
> >            enctype="text/plain"
> >            enctype="multipart/form-data"
> >            enctype="application/x-www-form-urlencoded"
>
>Um, yes, if you use MIME you can pretty much use any mix of formats you
>like. But it can be a challenge to do it by hand. (3.x has some mime +
>s/mime handling routines to take care of care of the bulk of this. It has
>to to be able to handle s/mime.)
>
>--min
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to