<CFHTTP> Tag - ColdFusion
>> Return to ColdFusion Tag Index
The <CFHTTP> tag allows you ...
<CFHTTP> Comments from Macromedia LiveDocs
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.)
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
I think https port is 443 not 413. The document on this page said 413.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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..
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
Does <CFHTTP METHOD="PUT"> work? If so I need an example.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
"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? ;-)
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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...
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
We have submitted bug report 55728 against the behavior reported by TomChiv on 6/1/04.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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\runtime\lib\security
Copy the dev certificate: (.cer) file to (cdrive) or (ddrive):\JRun4\runtime\jre\lib\security or CFusionMX\runtime\lib\security
Open command prompt
Enter: cd \JRun4\runtime\jre\lib\security or CFusionMX\runtime\lib\security
Enter: keytool -import -keystore cacerts -alias giveUniqueName -file certname.cer
Works like a charm.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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#">
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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> #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>
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
We have entered a bug, No. 54438, against this behavior
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
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?
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
> 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.
LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-p58.htm
[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.
[Top]
Recommended Books
COLDFUSION MX Web Application Construction Kit (5th Edition)
Authors: Ben Forta and Nate Weiss
1500 pages
[Top]
Web Sites
Macromedia
The makers of ColdFusion/ColdFusion MX.
ColdFusion Developer's Journal
Forta.com (ColdFusion Section)
Ben Forta is Macromedia's Senior Technical Evangelist. Here on his site find useful ColdFusion information.
Flash CFM
Flash and ColdFusion Development.
Handling file uploads without CFFILE
BLOG post by "Sam" on REWINDLIFE.COM gives insight into how to upload a file on your site if you are not allowed to use the CFFILE tag.
[Top]
Copyright © 2003- 2008, Orville Paul Chomer, All Rights Reserved
Home Page
Blog
How To
Chomer TV
The Show
Webcam Videos
Freeware
•
VB Mahjongg
Coding
•
ColdFusion
•
Javascript
•
Visual Basic
Other Places
Acoustic Eidolon
History Singers
Scobleizer
Beach Walks
Freshtopia
CSS Zen Garden