Posting Information
Besides allowing you to retrieve information, you can also post
information to remote web sites with CFHTTP
. By
setting the METHOD
attribute to
POST
, you can use CFHTTP
to
pass information such as files, URLs, CGI variables, cookies, and
form fields to other web applications, such as a ColdFusion page or
CGI program, on a remote server. CFHTTP
POST
operations are considered two-way
transactions because they pass variables to remote applications,
which usually process the input and return data.
When performing CFHTTP
POST
operations, you have to specify an additional tag,
CFHTTPPARAM
, for each value you are passing in the
transaction. In other words, if you are using
CFHTTP
to post two form-field variables to a
remote form, you need to use two CFHTTPPARAM
tags
in conjunction with the CFHTTP
tag. By specifying
the variable type in each CFHTTPPARAM
tag,
ColdFusion allows you to interact with applications that require
multipart form data such as cookies, text, and file fields in the
same operation. Note that CFHTTPPARAM
tags are
always nested within a CFHTTP
tag. Here is the
syntax for using the CFHTTPPARAM
tag:
<CFHTTPPARAM NAME="name
" TYPE="transaction_type
" VALUE="variable_value
" FILE="filename
">
The TYPE
attribute specifies the type of
information you are passing to the remote application. Possible
values are:
-
URL
Posts URL variables to applications that get parameters from information passed in URLs
-
FormField
Posts form-field data to applications that accept ...
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.