Description
Used in CFScript to generate an HTTP request and handle the response from the server.
Syntax
Mode |
Syntax |
---|---|
Creating the service |
new http() or createObject("component","http") |
Initializing the attributes |
Any one of the following:
|
Executing the service action |
httpService.send(_attribute-value_pair_) |
Properties
url |
charset |
clientcert |
clientcertpassword |
columns |
delimiter |
file |
firstrowasheaders |
getasbinary |
method |
multipart |
multiparttype |
name |
password |
path |
port |
proxyserver |
proxyport |
proxyuser |
proxypassword |
redirect |
resolveurl |
result |
textqualifier |
throwonerror |
timeout |
useragent |
username |
All attributes supported by the tag cfhttp can be used as attribute-value pairs. For example,
<cfhttp name="onerow"> |
can be used as
httpService.setName("onerow"); |
For details of the attributes, see the Attributes section for the tag cfhttp.
See also
History
ColdFusion 9: Added this function.
Methods
addParam
Description
Used to add cfhttpparam tags. For example, to specify http POST operations in CFScript. Specifies parameters to build an HTTP request.
Syntax
httpService.addParam(attribute-value pair)
Returns
Nothing
Arguments
All attributes supported by cfhttpparam tag can be used as attribute-value pairs.
send
Description
Used to generate an HTTP request and handle the response from the server.
Returns
A component on which the following methods can be invoked:
- GetResult(): To access the query object returned by the server if a name attribute is specified.
GetPrefix(): To access the cfhttp scope. This is equivalent to the result attribute of the cfhttptag.
Syntax
httpService.send(attribute_value pair)
Arguments
All attributes supported by the cfhttpparam tag.
setAttributes
Description
Sets attributes for the http function.
Returns
Nothing
Syntax
httpService.setAttributes (attribute-value pair)
Arguments
All arguments supported by the cfhttp tag.
getAttributes
Description
Gets attributes that were set for the http function.
Returns
Returns a struct with all or some of the service tag attribute values.
Syntax
httpService.get_Attributes_(attribute_list)
Arguments
A comma-separated list of attributes. If no list is specified, all defined attributes are returned.
clearAttributes
Description
Removes all attributes added for the http function.
Returns
Nothing
Syntax
httpService.clearAttributes(attribute_list)
Arguments
A comma-separated list of attributes.
clearParams
Description
Removes cfhttpparam tags that were added using the addParam method.
Returns
Nothing
Syntax
httpService.clearParams()
Arguments
None
clear
Description
Removes all attributes and cfhttpparam tags that were added using the addParam method.
Returns
Nothing
Syntax
httpService.clear()
Arguments
None
Usage
This function corresponds to the cfhttp tag. For usage details, see the Usage section for cfhttp in the CFML Reference.
Example
<!--- Get Video ---> |