
Using the cfhttp Post Method
337
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
cfhttpparam
tag for each variable you want to post. The Post method
passes data to a specified 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
cfhttp
in
a similar way. However, with
cfhttp
, the page that receives the Post does not, itself,
display anything.
To pass variables to a ColdFusion page:
1
Open a new file in ColdFusion Studio.
2
Modify the file so that it appears as follows:
<html>
<head>
<title>HTTP Post Test</title>
</head>
<body>
<H1>HTTP Post Test</H1>
<cfhttp method="Post"
url="http://127.0.0.1/myapps/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="[email protected]"
name="emailaddress">
<cfhttpparam type="File"
name="myfile"
file="c:\testImage.gif">
</cfhttp>
<cfoutput>
File Content:<br>
#cfhttp.filecontent#<br>
<br>
Mime Type: #cfhttp.MimeType#<br>
</cfoutput>
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...