O'Reilly logo

Programming ColdFusion by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required