O'Reilly logo

Programming ColdFusion MX, 2nd Edition 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"
             encoded="Yes|No"
             mimetype="MIME_type[and_charset]"
             file="filename">

The type attribute specifies the type of information you are passing to the remote application. Possible values are:

Body

Body of an HTTP request. Only one cfhttpparam tag with type="Body" can be used per cfhttp request. ...

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