Using The Cfhttp Post Method - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

236

Using the CFHTTP Post Method

Use the Post method to send cookie, form field, CGI, URL, and file variables to a
specified ColdFusion page or CGI program. For Post operations, you must use the
CFHTTPPARAM tag for each variable you want to post. Unlike the Get method, Post
passes data to a specified ColdFusion page or to some executable that interprets the
variables being sent and returns data.
For example, when you build an HTML form using the Post method, you specify the
name of the program to which form data will be passed. Using the Post method in
CFHTTP is exactly the same.
To pass variables to a ColdFusion page:
1.
Open a new file in Studio.
2.
Modify the file so that it appears as follows:
<CFHTTP METHOD="Post"
</CFHTTP>
<CFOUTPUT>
</CFOUTPUT>
3.
Replace the URL with one on your server.
4.
Save the file as
To view the variables:
1.
Create a new file in Studio.
2.
Modify the file so that it appears as follows:
URL="http://127.0.0.1/dwa_code/server.cfm"
USERNAME="user1"
PASSWORD="user1pwd">
<CFHTTPPARAM TYPE="Cookie"
VALUE="cookiemonster"
NAME="mycookie6">
<CFHTTPPARAM TYPE="CGI"
VALUE="cgivar "
NAME="mycgi">
<CFHTTPPARAM TYPE="URL"
VALUE="theurl"
NAME="myurl">
<CFHTTPPARAM TYPE="Formfield"
VALUE="wbfreuh@allaire.com"
NAME="emailaddress">
<CFHTTPPARAM TYPE="File"
NAME="myfile"
FILE="c:\temp\cyberlogo.gif">
#CFHTTP.filecontent#
#CFHTTP.mimetype#
in
server.cfm
Developing Web Applications with ColdFusion
under your Web root directory.
myapps

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents