Generates an HTTP request and parses the response from the server into a structure. The result structure has the following keys:statusCode
: The HTTP response code and reason string.fileContent
: The body of the HTTP response. Usually a string, but could also be a Byte Array.responseHeader
: A structure of response headers, the keys are header names and the values are either the header value or an array of values if multiple headers with the same name exist.errorDetail
: An error message if applicable.mimeType
: The mime type returned in the Content-Type response header.text
: a boolean indicating if the response body is text or binary.charset
: The character set returned in the Content-Type header.header
: All the http response headers as a single string.
<cfhttp url="">
cfhttp(url="");
80/443
get
get
post
put
delete
head
trace
options
patch
80
ColdFusion
utf-8
iso-8859-1
windows-1252
us-ascii
shift_jis
iso-2022-jp
euc-jp
euc-kr
big5
euc-cn
utf-16
false
true
true
auto
auto
no
yes
never
cfhttp
true
"
"
'
path
attribute.
false
false
true
form-data
form-data
related
BASIC
BASIC
NTLM
true
true
false
cfhttp(method="GET", charset="utf-8", url="https://www.google.com/", result="result") {
cfhttpparam(name="q", type="url", value="cfml");
}
writeDump(result);
httpService = new http(method = "GET", charset = "utf-8", url = "https://www.google.com/");
httpService.addParam(name = "q", type = "url", value = "cfml");
result = httpService.send().getPrefix();
writeDump(result);
<cfhttp result="result" method="GET" charset="utf-8" url="https://www.google.com/">
<cfhttpparam name="q" type="url" value="cfml">
</cfhttp>
<cfdump var="#result#">
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.