User Guide

220 Chapter 2: ColdFusion Tags
Variables returned by a cfhttp get operation
The cfhttp tag returns the following variables. If you set the result attribute, the name you
assign replaces
cfhttp as the prefix. For additional information, see the result attribute.
Building a query from a delimited text file
The cfhttp tag can create a ColdFusion query object form the response body. To do so, the
response body must consist of lines of text, with each line having fields that are delimited by a
character that identifies the column breaks. The default delimiter is a comma (,). The response
data can also use a text qualifier; the default is a double-quotation mark ("). If you surround a
string field in the text qualifier, the field can contain the delimiter character. To include the text
qualifier in field text, escape it by using a double character. The following line shows a two-line
request body that is converted into a query. It has three comma-delimited fields:
Field1,Field2,Field3
"A comma, in text","A quote: ""Oh My!""",Plain text
Name Description
cfhttp.charSet Response character character set (character encoding) specified by the
response Content-Type header.
cfhttp.errorDetail If the connection to the HTTP server fails, contains details about the
failure. For instance: "Unknown host: my.co.com"; otherwise, the empty
string. Macromedia recommends that you check this variable for an error
condition before checking other variables.
cfhttp.fileContent Response body; for example, the contents of a html page retrieved by a
GET operation. Empty if you save the response in a file.
cfhttp.header Raw response header containing all header information in a single string.
Contains the same information as the
cfhttp.responseHeader variable.
cfhttp.mimeType MIME type specified by the response Content-Type header; for
example, text/html.
cfhttp.responseHeader The response headers formatted into a structure. Each element key is
the header name, such as Content-Type or Status_Code. If there is more
than one instance of a header type, the type values are put in an array.
One common technique is to dynamically access the
cfhttp.responseHeader structure as a dynamic array; for example,
#cfhttp.resonseHeader[fieldVariable]#.
cfhttp.statusCode The HTTP status_code header value followed by the HTTP Explanation
header value; for example, "200 OK".
cfhttp.text Boolean; True if the response body content type is text. ColdFusion
recognizes the response body as text if:
the header does not specify a content type.
the content type starts with "text".
the content type starts with "message".
the content type is "application/octet-stream".