Using The Cfhttp Post Method - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

columns="ID,Number,ODate,SDate,Name,Address"
textqualifier="">
<cfoutput query="juneorders">
Order ID: #ID#<br>
Order Number: #Number#<br>
Order Date: #SDate#<br>
</cfoutput>
Save the file as query_textfile.cfm in the myapps directory under your web_root and view it in
4
the web browser.

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 processing. For Post operations, you must use the
tag for each variable you want to post. The Post method passes data to a specified
cfhttpparam
ColdFusion page or an 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
page to which form data is passed. You use the Post method in
with
, the page that receives the Post does not, itself, display anything.
cfhttp
To pass variables to a ColdFusion page:
Create a ColdFusion page with the following content:
1
<html>
<head>
<title>HTTP Post Test</title>
</head>
<body>
<h1>HTTP Post Test</h1>
<cfhttp method="Post"
url="http://127.0.0.1:8500/myapps/post_test_server.cfm">
<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="twriter@macromedia.com"
name="emailaddress">
<cfhttpparam type="File"
name="myfile"
file="c:\pix\trees.gif">
</cfhttp>
<cfoutput>
File Content:<br>
#cfhttp.filecontent#<br>
Mime Type:
</cfoutput>
</body>
</html>
812
Chapter 36: Interacting with Remote Servers
#cfhttp.MimeType#<br>
in a similar way. However,
cfhttp

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents