User Guide
cfhttp 219
When ColdFusion receives a response to a cfhttp request, it can put the response body (if any) in
a file or the
cfhttp.FileContent string variable. If the body text is structured as a result set,
ColdFusion can put the body text in query object. You can also access the values of all returned
headers and specify how to handle error status and redirections, and specify a timeout to prevent
requests from hanging.
The HTTP protocol is the backbone of the World Wide Web and is used for every web
transaction. Because the
cfhttp tag can generate most types of requests, it provides significant
flexibility. Possible uses include:
• Interacting with dynamic web sites and services that are not available as web services. (Use the
the
cfinvoke tag to access SOAP web services.)
• Getting the contents of an HTML page or other file such as an image on a web server for use
in your CFML page or storage in a file.
• Sending a secure request to a server by specifying the https protocol in the url attribute.
• Using the POST method to send a multipart/form-data style post to any URL that can handle
such data and return results, including CGI executables or even other ColdFusion pages.
• Using the PUT method to upload files to a server that does not accept FTP requests.
This tag can, and for PUT and POST requests must, have a body that contains
cfhttpparam
tags. If this tag has
cfhttpparam tags, it must have a </cfhttp> end tag.
To use HTTPS with the
cfhttp tag, you might need to manually import the certificate for each
web server into the keystore for the JRE that ColdFusion uses. This procedure should not be
necessary if the certificate is signed (issued) by an authority that the JSSE (Java Secure Sockets
Extension) recognizes (for example, Verisign); that is, if the signing authority is in the cacerts
already. However, you might need to use the procedure if you are issuing SSL (secure sockets
layer) certificates yourself.
To manually import a certificate:
1.
Go to a page on the SSL server in question.
2.
Double-click the lock icon.
3.
Click the Details tab.
4.
Click Copy To File.
5.
Select the base64 option and save the file.
6.
Copy the CER file into C:\CFusionMX7\runtime\jre\lib\security (or whichever JRE
ColdFusion is using).
7.
Run the following command in the same directory (keytool.exe is located in
C:\CFusionMX7\runtime\jre\bin):
keytool -import -keystore cacerts -alias giveUniqueName -file filename.cer