View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cfhttp PreviousNext

cfhttp

Generates an HTTP request and handles the response from the server.

Forms tags, Internet Protocol tags

<cfhttp 
url = "server_URL"
port = "port_number"
method = "method_name"
proxyServer = "hostname"
proxyPort = "port_number"
proxyUser = "username"
proxyPassword = "password"
username = "username"
password = "password"
userAgent = "user_agent"
charset = "character encoding"
resolveURL = "yes" or "no"
throwOnError = "yes" or no"
redirect = "yes" or "no"
timeout = "timeout_period"
getasbinary = "yes or no"
multipart = "yes or no"
path = "path"
file = "filename"
name = "queryname"
columns = "query_columns"
firstrowasheaders = "yes" or "no"
delimiter = "character"
textQualifier = "character"
> cfhttpparam tags [optional for some methods]
</cfhttp>

cfhttpparam, GetHttpRequestData, cfftp, cfldap, cfmail, cfpop, SetEncoding

ColdFusion MX 6.1:

ColdFusion MX:

The following attributes control the HTTP transaction and can be used for all HTTP methods:

Attribute

Req/Opt

Default

Description

url

Req

Uses the http protocol

Address of the resource on the server which will handle the request. The URL must include the hostname or IP address.

If you do not specify the transaction protocol (http:// or https://), ColdFusion defaults to http.

If you specify a port number in this attribute, it overrides any port attribute value.

The cfhttppparam tag URL attribute appends query string attribute-value pairs to the URL.

port

Opt

80 for http

413 for https

Port number on the server to which to send the request. A port value in the url attribute overrides this value.

method

Opt

GET

  • GET Requests information from the server. Any data that the server requires to identify the requested information must be in the URL or in cfhttp type="URL" tags.
  • POST Sends information to the server for processing. Requires one or more cfhttpparam tags. Often used for submitting form-like data.
  • PUT Requests the server to store the message body at the specified URL. Use this method to send files to the server.
  • DELETE Requests the server to delete the specified URL.
  • HEAD Identical to the GET method, but the server does not send a message body in the response. Use this method for testing hypertext links for validity and accessibility, determining the type or modification time of a document, or determining the type of server.
  • TRACE Requests that the server echo the received HTTP headers back to the sender in the response body. Trace requests cannot have bodies. This method enables the ColdFusion application to see what is being received at the server, and use that data for testing or diagnostic information.
  • OPTIONS A request for information about the communication options available for the server or the specified URL. This method enables the ColdFusion application to determine the options and requirements associated with a URL, or the capabilities of a server, without requesting any additional activity by the server.

proxyServer

Opt

 

Host name or IP address of a proxy server to which to send the request.

proxyPort

Opt

80

Port number to use on the proxy server.

proxyUser

Opt

 

User name to provide to the proxy server.

proxyPassword

Opt

 

Password to provide to the proxy server.

username

Opt

 

A username. May be required by server.

password

Opt

 

A password. May be required by server

userAgent

Opt

Cold
Fusion

Text to put in the user agent request header. Used to identify the request client software. Can make the ColdFusion application appear to be a browser.

charset

Opt

For request: UTF-8

For response: charset specified by response Content- Type header, or UTF-8 if response does not specify charset.

The character encoding of the request, including the URL query string and form or file data, and the response. The following list includes commonly used values:

  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • big5
  • euc-cn
  • utf-16

For more information character encodings, see:
www.w3.org/International/O-charset.html.

resolveURL

Opt

No

  • No does not resolve URLs in the response body. As a result, any relative URL links in the response body do not work.
  • Yes resolves URLs in the response body to absolute URLs, including the port number, so that links in a retrieved page remain functional. Applies to these HTML tags:

- img src

- a href

- form action

- applet code

- script src

- embed src

- embed pluginspace

- body background

- frame src

- bgsound src

- object data

- object classid

- object codebase

- object usemap

throwOnError

Opt

No

  • Yes if the server returns an error response code, throws an exception that can be caught using the cftry and cfcatch or ColdFusion error pages.
  • No does not throw an exception if an error response is returned. In this case, your application can use the cfhttp.StatusCode variable to determine if there was an error and its cause.

redirect

Opt

Yes

If the response header includes a Location field, determines whether to redirect execution to the URL specified in the field.

  • Yes redirects execution to the specified page.
  • No stops execution and returns the response information in the cfhttp variable, or throws an error if the throwOnError attribute is True.

The cfhttp.responseHeader.Location variable contains the redirection path. ColdFusion follows a maximum of four redirects on a request. If there are more, ColdFusion functions as if redirect ="no".

timeout

Opt

 

Value, in seconds of the maximum time the request can take. If the timeout passes without a response, ColdFusion considers the request to have failed.

If the client specifies a timeout in the URL search parameter (for example, ?RequestTime=120) ColdFusion uses the lesser of the URL timeout and the timeout attribute value; this ensures that the request times out before, or at the same time as, the page.

If the URL does not specify a timeout, ColdFusion uses the lesser of the Administrator timeout and the timeout attribute value.

If the timeout is not set in any of these, ColdFusion waits indefinitely for the cfhttp request to process.

getAsBinary

Opt

No

  • No If ColdFusion does not recognize the response body type as text, convert it to a ColdFusion object.
  • Auto If ColdFusion does not recognize the response body type as text, convert it to ColdFusion Binary type data.
  • Yes Always convert the response body content into ColdFusion Binary type data, even if ColdFusion recognizes the response body type as 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"

If ColdFusion does not recognize the body as text and converts it to an object, but the body consists of text, the cfoutput tag can display it. The cfoutput tag cannot display Binary type data. (To convert binary data to text, use the ToString function.)

The following attribute is used with the PUT method to determine how to send data specified with httpparam type="formField":

Attribute

Req/Opt

Default

Description

multipart

Optional

No

(Sends as multipart only if request includes File type data.)

Tells ColdFusion to send all data specified by cfhttpparam type="formField" tags as multipart form data, with a Content-Type of multipart/form-data. By default, ColdFusion sends cfhttp requests that contain only formField data with a Content Type of application/x-www-form-urlencoded. (If the request also includes File type data, ColdFusion uses the multipart/form-data content type for all parts.)

If Yes, ColdFusion also sends the request's charset in each Content-Type description. All form field data must be encoded in this character encoding, and ColdFusion does not URLEncode the data. (The field name must be in ISO-88591-1 or ASCII.) Some http parsers, including the one used by previous versions of ColdFusion, ignore the multipart form field character encoding description.

The following attributes tell ColdFusion to put the HTTP response body in a file. You can put the response body in a file for GET, POST, PUT, DELETE, OPTIONS, and TRACE methods, but it is generally not useful with DELETE or OPTIONS.

Attribute

Req/Opt

Default

Description

path

Required if file is specified.

 

Tells ColdFusion to save the HTTP response body in a file. Contains the absolute path to the directory in which to store the file.

file

Required if path is specified and not a GET method

See Description

Name of file in which to store the response body.

For a GET operation, defaults to the file requested in the URL, if there is one. For example, if the URL in a GET method is http:www.myco.com/test.htm, the default file is test.htm. Do not specify the path to the directory in this attribute, use the path attribute.

The following attributes tell ColdFusion to convert the HTTP response body into a ColdFusion query object. They can be used with the GET and POST methods only:

Attribute

Req/Opt

Default

Description

name

Opt

 

Tells ColdFusion to create a query object with the given name from the returned HTTP response body.

columns

Opt

First row of response contains column names.

The column names for the query, separated by commas. Column names must start with a letter. The remaining characters can be letters, numbers, or underscores (_).

If there are no column name headers in the response, specify this attribute to identify the column names.

If you specify this attribute and the firstrowasHeader attribute is true (the default), the column names specified by this attribute replace the first line of the response. You can use this behavior to replace the column names retrieved by the request with your own names.

If a duplicate column heading is encountered in either this attribute or in the column names from the response, ColdFusion appends an underscore to the name to make it unique.

If the number of columns specified by this attribute does not equal the number of columns in the HTTP response body, ColdFusion generates an error.

firstrowas
headers

Opt

Yes

Determines how ColdFusion processes the first row of the query record set.

  • Yes processes the first row as column heads. If you specify a columns attribute, ColdFusion ignores the first row of the file.
  • No processes the first row as data. If you do not specify a columns attribute, ColdFusion generates column names by appending numbers to the word "column"; for example, "column_1".

delimiter

Opt

, [comma]

A character that separates query columns. The response body must use this character to separate the query columns.

textQualifier

Opt

" [double quotation mark]

A character that, optionally, specifies the start and end of a text column. This character must surround any text fields in the response body that contain the delimiter character as part of the field value.

To include this character in column text, escape it by using two characters in place of one. For example, if the qualifier is a double quotation mark, escape it as "".

The cfhttp tag is a general-purpose tool for creating HTTP requests and handling the returned results. It enables you to generate most standard HTTP request types. You use embedded cfhttpparam tags to specify request headers and body content.

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:

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.

Variables returned by a cfhttp get operation

The cfhttp tag returns the following variables:

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

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"

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

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:

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 underscores (_).

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

<!--- 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"/>

<!--- Parse the xml and output a list of resources --->
<cfset xmlDoc = XmlParse(CFHTTP.FileContent)>
<!--- Get the array of resource elements, the xmlChildren of the xmlroot --->
<cfset resources=xmlDoc.xmlroot.xmlChildren>
<cfset numresources=ArrayLen(resources)>

<cfloop index="i" from="1" to="#numresources#">
    <cfset item=resources[i]>
    <cfoutput>
        <strong><a href=#item.url.xmltext#>#item.title.xmltext#</strong></a><br>
        <strong>Author</strong>&nbsp;&nbsp;#item.author.xmltext#<br>
        <strong>Applies to these products</strong><br>
        <cfloop index="i" from="4" to="#arraylen(item.xmlChildren)#">
            #item.xmlChildren[i].xmlAttributes.Name#<br>
        </cfloop>
        <br>
    </cfoutput>
</cfloop>

Contents > CFML Reference > ColdFusion Tags > cfhttp PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


gwolford said on Aug 6, 2003 at 10:36 AM :
The documentation for the cfhttp tag suggests that the default port for a protocol specification is 413, but I suspect that should read 443.
csteinola said on Sep 24, 2003 at 11:41 AM :
I've never been able to get redirect to behave as expected.

Posting page:
<html>
<head>
<title>Untitled</title>
</head>

<body>
Here I am on the posting page<br />
<CFHTTP url="http://localhost/form_ok.cfm" method="POST" resolveurl="yes" throwonerror="yes" redirect="yes">
<CFHTTPPARAM type="HEADER" name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)">
<CFHTTPPARAM type="HEADER" name="Connection" value="Keep-Alive">
<CFHTTPPARAM type="HEADER" name="Cache-Control" value="no-cache">
<CFHTTPPARAM type="FORMFIELD" name="test1" value="Hello">
<CFHTTPPARAM type="FORMFIELD" name="test2" value="World">
</CFHTTP>
</body>
</html>

form_ok.cfm page:
<html>
<head>
<title>Untitled</title>
<CFHEADER name="Location" value="http://localhost/form_ok.cfm">
</head>

<body>
Here I am on the ok page<br />
<CFDUMP var="#FORM#">
</body>
</html>

I would expect that the CFHTTP would follow the redirect="yes" attribute, and, since the response header contains a Location field, the form_ok.cfm page should be displayed.
But it doesn't. All I ever see is "Here I am on the posting page". If I check CFHTTP.FileContents, the ok page is there. And if I check cfhttp.responseHeader, the Location field contains the URL to the ok page.

Has anybody gotten this to work?
halL said on Sep 24, 2003 at 2:34 PM :
With respect to the redirect attribute:
When ColdFusion executes a page with a CFHTTP tag with redirect="Yes", and it receives a redirection message in response to the HTTP request, it sends a request to the redirection target and handles the response as if it had been the result of the original request.
Also, the page should state ColdFusion does the redirection only if it receives both a Location header AND a 300-series (redirection) status code.
The example from csteinola tries to use a cfheader tag to force a redirection, but this does not send a 300 status, and therefore does not force the redirection.
(The cflocation tag does generate an HTTP 302 resonse with the url attribute as the Location header value.)
CF_Brian said on Oct 8, 2003 at 1:16 PM :
I am using cfhttp to invoke a jsp on another machine with the following call:

<cfset httpurl = "http://abcd.kj.ko.com:9001/jkl/mko/header.jsp?title=My-Home">

<cfhttp url="#httpurl#" method="GET">
</cfhttp>

When I make this cfhttp call the "HOST" and the "REFERER" request headers are
not populated correctly. Apparently the port information (9001) is getting
dropped from the HOST header.

Brian
rudylin555 said on Oct 31, 2003 at 6:40 AM :
I was able to use cfhttp to pull up a http page, but could not pull up a https page.
jladams97 said on Jan 14, 2004 at 9:02 AM :
CF_Brian--did you try including the port value as the value of the port attribute rather than including directly as a part of the value of the URL attribute? What about including your URL variables in <cfhttpparam> tags rather than directly as a part of the URL attribute? Try this code:

<cfset httpurl = "http://abcd.kj.ko.com/jkl/mko/header.jsp">
<cfset httpport = 9001>
<cfset httpvarname = "title">
<cfset httpvarval = "My-Home">

<cfhttp url="#httpurl#" port="#httpport#" method="GET">
<cfhttpparam name="#httpvarname#" type="URL" value="#httpvarval#">
</cfhttp>
No screen name said on Jan 27, 2004 at 5:20 AM :
I buildt a customtag to check a forumusers posts and nick in a forum on cf 5.0
When executing the same cfhttp code in cfmx 6.1 (on linux)
I get this error:
"The column name "<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>" is invalid.

Column names must be valid variable names. They must start with a letter and can only include letters, numbers, and underscores."

the code:
<cfparam name="request.userid" default="0" type="numeric">

<cfhttp url="http://server/index.php?showuser=#request.hw_no_id#" method="post" name="hGetHWInfo">
<cfhttpparam name="hardwaremember_id" type="cookie" value="value">
<cfhttpparam name="hardwarepass_hash" type="cookie" value="value">
</cfhttp>
No screen name said on Feb 20, 2004 at 3:21 PM :
<CFHTTP> Tag

I have a file that uses the <CFHTTP> tag and it work perfect in Cold Fusion 5.0 & 4.51. However using the same file in Cold Fusion MX 6.01 it does not respond the same way as it did in 5.0.

Any reason why this tag would work in Cold Fusion 5.0 or lower but not in MX 6.01?
csteinola said on Feb 24, 2004 at 11:19 AM :
> Any reason why this tag would work in Cold Fusion 5.0 or lower but not in MX 6.01?

Many reasons. Most of them involve bugs in 5.0 that let the CFHTTP tag work when it really shouldn't have.

Check out the "ColdFusion MX 6.1" and "ColdFusion MX" sections at the top of this page. That might provide clues.
csteinola said on Feb 24, 2004 at 11:10 AM :
[i]I get this error:
"The column name "<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>" is invalid.

Column names must be valid variable names. They must start with a letter and can only include letters, numbers, and underscores."

the code:
<cfparam name="request.userid" default="0" type="numeric">

<cfhttp url="http://server/index.php?showuser=#request.hw_no_id#" method="post" name="hGetHWInfo"> .... [/i]

Since you're specifying a "name" attribute, you're trying to return a query... but since you don't specify column names in a "columns" attribute, you're telling CFHTTP that the first row of the returned query (dataset) will contain the column names.

In this case, it looks like your server/index.php file is returning a full HTML page, including DOCTYPE header, probably HTML, HEAD and BODY tags as well. For whatever reason, ColdFusion doesn't like the DOCTYPE header as a column name. But that's okay... because that's probably not what you intended anyway.

If you're truly trying to return a query, your server/index.php page should only return data... not any of the HTML tags.

And if you're not trying to return a query, then you shouldn't use the "name" attribute of CFHTTP.
No screen name said on Feb 29, 2004 at 7:13 PM :
Did I miss something in the documentation, or does resolveURL not resolve URLs when saving the HTTP response body in a file using the path attribute? I know I can use cffile for this, but why the extra step?
halL said on Mar 1, 2004 at 7:50 AM :
We have entered a bug, No. 54438, against this behavior
farDesi said on Mar 23, 2004 at 3:29 PM :
If you can't get https working with cfhttp then take a look at

http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=13865&forumid=4%3E%20&threadid=13865&forumid=4&threadid=13865&forumid=4
wlee said on Mar 25, 2004 at 7:51 AM :
We are working to improve the examples in the ColdFusion reference pages. We propose to replace the current example on this page with the the following example. If you have any comments on this example, add them to this page.

<!--- This example displays the information provided by the Macromedia
Designer & Developer Center XML feed,
http://www.macromedia.com/devnet/resources/macromedia_resources.rdf
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/devnet/resources/macromedia_resources.rdf">

<!--- 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"/>

<!--- Parse the xml and output a list of resources --->
<cfset xmlDoc = XmlParse(CFHTTP.FileContent)>

<!--- Get the array of resource elements, the xmlChildren of the xmlroot --->
<cfset resources=xmlDoc.xmlroot.item>
<cfset numresources=ArrayLen(xmlDoc.xmlRoot.xmlChildren)-1>
<cfloop index="i" from="1" to="#numresources#">
<cfset item=resources[i]>
<cfoutput>
<strong><a href=#item.link.xmltext#>#item.title.xmltext#</strong></a><br>
<strong>Author</strong>&nbsp;&nbsp;#item.creator.xmltext#<br>
<strong>Description</strong> #item.description.xmlText#<br>
<strong>Applies to these products</strong><br>
<cfloop index="i" from="1" to="#arrayLen(item.subject)#" step="1">
#item.subject[i].xmltext#<br>
</cfloop>
<br>
</cfoutput>
</cfloop>
pcrowley said on Apr 19, 2004 at 8:19 AM :
I am trying to do a raw post, that is mimic the following VB code
Set objXMLHttp = New msxml2.XMLHTTP40
objXMLHttp.Open "POST",
"http://thewebsite.com/IPF/post/submitvehicle.asp", False, "", ""
objXMLHttp.setRequestHeader "Content-type", "application/xml"
objXMLHttp.send XMLDoc

I see that Shawn Porter's CF_HTTPRequest ( http://rit.net/~sporter/ColdFusion/HTTPRequest/ ) has a "raw post" and was wondering if this type of post is supported in 6.1 cfhttpparam.
I am currently trying
<CFHTTPPARAM type="XML" value="#request.xml#">
strikefish said on Apr 21, 2004 at 3:29 AM :
faDesi is right on with the solution for https woes and cfhttp. Stacy Young's entry here describes the following. http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=13865&forumid=4%3E%20&threadid=13865&forumid=4&threadid=13865&forumid=4. MM, please get this in your docs, it hindered our upgrade efforts. Here are the details from houseoffusion:

Add to system path variable: (cdrive) or (ddrive):\JRun4\runtime\jre\bin or CFusionMX\runtimeib\security
Copy the dev certificate: (.cer) file to (cdrive) or (ddrive):\JRun4\runtime\jreib\security or CFusionMX\runtimeib\security
Open command prompt
Enter: cd \JRun4\runtime\jreib\security or CFusionMX\runtimeib\security
Enter: keytool -import -keystore cacerts -alias giveUniqueName -file certname.cer

Works like a charm.
TomChiv said on Jun 1, 2004 at 9:14 AM :
When using resolveURL, cfhttp mangles href's to links inside of the document, rather than leaving them intact.

I.e. if I have a <a name="wibble"> in the doucment and write
<a href="#wibble">click me</a>, and then request that file over cfhttp, the href should stay as-is - there is no need to add extra information to it.
halL said on Jun 1, 2004 at 1:00 PM :
We have submitted bug report 55728 against the behavior reported by TomChiv on 6/1/04.
Daniel Elmore said on Jun 10, 2004 at 9:35 AM :
The descriptions for attributes username and password don't tell you anything. It should say something like:
To pass Basic Authentication to the target URL, include login information in these fields. The username and password will be combined to form a base64 encoded string passed in an Authenticate header. Note: This is does not provide support for Intergrated Windows, NTLM, or Kerebos authentication.

Also I found this statement in the notes to be false:
"The cfhttp tag supports Basic Authentication for all operations. However, Basic Authentication does not work if your web server has Windows NT Challenge/Response (Microsoft IIS) enabled."
*The Basic Authentication did work even when Integrated Authentication was on.

And this statement:
"The cfhttp tag does not support NTLM or Digest Authentication with proxy servers. If a proxy server requires authentication, it must allow Basic Authentication."
This leaves a question unanswered, are you saying that cfhttp DOES support NTLM or Digest over other requests??? I could not figure out how to use NTLM or Digest at all. If this is the case, why not say
"The cfhttp tag does not support NTLM or Digest Authentication" Period
carehart said on Jun 13, 2004 at 6:39 AM :
Though the text doesn't say so, in my testing when using the NAME attribute to read the result in to create a query resultset, if a list of column names is provided on the first line of the file, there must be no spaces after the comma separating the column names.
dlakein said on Jul 5, 2004 at 12:42 PM :
Another thing the text should say is to check cfhttp.errorDetail before accessing headers.

If there is an unknown host or other similar error, cfhttp.header is an "undefined struct element" (what I see from cfdumping cfhttp), and accessing it gets a null pointer exception. This may be from the underlying Java object?

Might make more sense for CF to default Header to a null string, like Responseheader is an empty structure.
webtura said on Sep 9, 2004 at 3:32 AM :
MX6.1: CFHTTP sends the header "Connection" with the wrong value "Close,TE" - only "Close" or "Keep-Alive" are allowed.

In this documentation: "ColdFusion MX 6.1 changed behavior for multiple headers: multiple headers of the same type are returned in an array. "
( By the way: this means it's impossible e.g. to set an User-Agent to a normal browser without having "ColdFusion" also set as User-Agent .)

Setting the header "Connection" to "Keep-Alive" does not result in "Close,Keep-Alive"(would be wrong) - but in "Keep-Alive,TE" (also wrong)...

How can the default used header informations, embedded in the CFHTTP-tag, be changed?
extdw_doc said on Sep 20, 2004 at 10:55 AM :
To strikefish and farDesi:

Re: https working with cfhttp, the procedure for importing the certificate should not be necessary IF the
certificate is signed (issued) by an authority that the JSSE recognizes (e.g., Verisign); that is, if the
signing authority is in the cacerts already. If the certificate is "self signed" then you
do have to import it.

So if your are issuing the certificates yourself, you are likely to need to do the procedure you've
described.
Ben Keen said on Sep 27, 2004 at 11:28 AM :
After reading over the above comments and responses, I'm still confused with regard to the "redirect" attribute. Either it's extremely counter-intuitive, or I'm being daft.

Here's my problem (I think it's a common one): I wish to redirect to another page, sending along form variables at the same time - just like with a regular form. The documentation leads me to believe this is possible.

Can this be done with the <cfhttp> tag using the redirect="yes" attribute?
Marty Pine said on Oct 18, 2004 at 10:11 PM :
Question: When sending XML to a Coldfusion page (via cfhttp or by some other means) what scope does it show up in on the receiving page? I can send data no worries, but when I send it to a CFM page, I can't seem to reference the XML string that I sent. what scope is it in? I can email myself a dump of all the main scopes (cgi, form, url) and it is in none of them...
CFMunster said on Oct 22, 2004 at 11:21 AM :
I am having a problem with CFHTTP redirect. I am querying a knowledge base Web-based application. I call the app using cfhttp with redirect=yes, but the site does not return the expected output.

What I have found during my debugging is that the redirect sends back a 302 status code but it also sends back a set-cookie header with two cookies to set. I get the feeling that the cookies are not being set by cfhttp on the redirect. Is CFHTTP (CFMX 6.1) able to set cookies on redirect?
Robert Oakland said on Jan 11, 2005 at 8:44 AM :
CFMunster - You'll likely need to turn the redirect flag to no. After much research, I've found that if a cfhttp call encounters a redirect/302 header _before_ the actual set-cookie header (set-cookie header can come before, after, or both according to HTTP1.1 RFCs) then apparently ColdFusion (or the underlying JAVA platform) simply ignores the headers after a certain point. To fix this, set redirect=no on the cfhttp tag, then code to grab the value of the Location header, and either get (cfhttp again) that page (likely, passing along cookies that you'll need to parse from the previous CFHTTP calls response field/s) or cflocation redirect to that page. Clear as mud? This drove me crazy for like a week and a half. I think the default behavior of cfhttp should be redirect=no, personally, to avoid these types of problems.
jladams97 said on Jan 17, 2005 at 8:48 PM :
If you're having a problem getting an unexpected "Connection Failure" response when using cfhttp, check out this URL:

http://www.talkingtree.com/blog/index.cfm?mode=day&day=28&month=07&year=2004

Macromedia--you guys really need to get this up in a TechNote on your site. If it is there, my apologies, but I did look and didn't see anything.
AlanA said on Jan 27, 2005 at 6:11 AM :
"We are working to improve the examples in the ColdFusion reference pages. We propose to replace the current example on this page with the the following example. If you have any comments on this example, add them to this page."

If the feed is down, what happens? I would suggest adding an error check.
Because we know all feeds are up all the time...right? ;-)
twillerror said on Feb 14, 2005 at 3:10 PM :
cfhttps to a certificate with an invalid common name will fail.

If your server is using a cert with a mismatching common name, CF will fail with an I/O Exception in cfhttp.errordetail.

Obviously it would be nice to use the correct cert, but for testing purposes we have to have them different.

cfhttp may need a way to ignore this.
matthewReinbold said on Feb 16, 2005 at 12:28 PM :
I had some problems with the path attribute. The text says that the file attrubute is not needed if the method used is "get". However, when looping through an array of URL's, and using the current item in the array as the URL variable, ColdFusion outputted a file with the name of the first file. All the following gets took the contents retrieved from the web and over-wrote the contents of the first file, keeping the same name. I had to use the file attribute to give each distinct name in order for my loop to work.

Is this a bug?
creep80209 said on Feb 23, 2005 at 2:08 PM :
Does <CFHTTP METHOD="PUT"> work? If so I need an example.
Mobeus said on Sep 23, 2005 at 11:22 AM :
Using the method="POST" is this supposed to go to the URL defined in the CFHTTP? For example <CFHTTP url="http://localhost/test/cfhttp/cfhttppagehandle.cfm" method="POST" resolveurl="yes" throwonerror="yes" redirect="yes"> is it supposed to go to the page cfhttppagehandle.cfm? If so, what am i doing wrong here coz it is not behaving that way.
ElevenBravo said on Dec 8, 2005 at 3:12 PM :
Mobeus - The documentation states that if you are using POST method you need to include at least one CFHTTPPARAM with your request. In your post, it looks like you're not sending any params, unless you only posted partial code. Your code might look like this:
<CFHTTP url="http://localhost/test/cfhttp/cfhttppagehandle.cfm" method="POST" resolveurl="yes" throwonerror="yes" redirect="yes">
<CFHTTPPARAM name="UserName" type="FORMFIELD" value="#username#">
<CFHTTPPARAM name="Password" type="FORMFIELD" value="#password#">
</CFHTTP>

Hope this helps..
Suwarat said on Mar 16, 2006 at 4:25 PM :
I think https port is 443 not 413. The document on this page said 413.
Oblio said on Jun 6, 2006 at 11:20 AM :
Be careful that any comments inside the cfhttp tag are CF comments, not HTML comments! (Authorize.net's example code will fail because of that.)
mlennox said on Jul 27, 2006 at 3:25 PM :
The document states: "GET Requests information from the server. Any data that the server requires to identify the requested information must be in the URL or in cfhttp type="URL" tags."

I think it should read: "GET Requests information from the server. Any data that the server requires to identify the requested information must be in the URL or in cfhttpparam "type="URL" tags.
Robert_Mack said on Oct 15, 2006 at 6:15 PM :
CFHTTP will not post to an https page with an expired certificate. This isn't a bug but the error message isn't very informative:
COM.Allaire.ColdFusion.HTTPFailure
Connection Failure: Status code unavailable

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p58.htm