User Guide
cfhttp 221
Run the following code to show how ColdFusion treats this data:
<cfhttp method="Get"
url="127.0.0.1:8500/tests/escapetest.txt"
name="onerow">
<cfdump var="#onerow#"><br>
Column names can be specified in three ways:
• By default, ColdFusion uses the first row of the response as the column names.
• If you specify a comma-delimited columns attribute, ColdFusion uses the names specified in
the attribute as the column names. Set
firstRowAsHeaders="no" if the first row of the
response contains data. Otherwise, ColdFusion ignores the first row.
• If you do not specify a columns attribute and set firstrowasheaders="no", ColdFusion
generates column names of the form Column_1, Column2, etc.
The
cfhttp tag checks to ensure that column names in the data returned by the tag start with a
letter and contain only letters, numbers, and underscore characters (_).
ColdFusion checks for invalid column names. Column names must start with a letter. The
remaining characters can be letters, numbers, or underscores (_). If a column name is not valid,
ColdFusion generates an error.
Notes
• For the ColdFusion MX Administrator timeout and the URL timeout to take effect, you must
enable the timeout in the ColdFusion MX Administrator, Server Settings page. For more
information, see Configuring and Administering ColdFusion MX.
• The cfhttp tag supports Basic Authentication for all operations.
• The cfhttp tag uses SSL to negotiate secure transactions.
• If you put the HTTP response body in a file, ColdFusion does not put it in the
CFHTTP.FileContent variable or generate a query object. If you do not put the response body
in a file, ColdFusion puts it in the CFHTTP.FileContent variable; if you specify a
name
attribute ColdFusion generates a query object.
• The cfhttp tag does not support NTLM or Digest Authentication.
Example
<!--- This example displays the information provided by the Macromedia
Designer & Developer Center XML feed,
http://www.macromedia.com/desdev/resources/macromedia_resources.xml
See http://www.macromedia.com/desdev/articles/xml_resource_feed.html
for more information on this feed. --->
<!--- Set the URL address. --->
<cfset urlAddress="http://www.macromedia.com/desdev/resources/
macromedia_resources.xml">
<!--- Use the CFHTTP tag to get the file content represented by urladdress.
Note that />, not an end tag, terminates this tag. --->
<cfhttp url="#urladdress#" method="GET" resolveurl="Yes" throwOnError="Yes"/>