> 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.

You're making this harder on yourself than you have to! Just build one big
string containing your form post. If you're using CF 5, you can use the
CFSAVECONTENT tag for this to make it a tiny bit easier:

<cfsavecontent variable="myformpost">
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

[EMAIL PROTECTED]&Name=Osama&Action=Submit
</cfsavecontent>

<cfset obj.SendRN(myformdata)>

There are a couple of points worth noting. First, the only thing separating
the form data from the HTTP header is two carriage returns. Second, the
Content-Length header should match the string length of the form data.

Dave Watts, CTO, Fig Leaf Software 
http://www.figleaf.com/ 
voice: (202) 797-5496 
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
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