CFHTTP
CFHTTP allows you to interact with remote HTTP sites, from simply downloading a file, to submitting form data. Using the CFHTTPPARAM you can control all aspects of the HTTP experience
Usage
<cfhttp>
Attributes
Attribute | default | required | summary |
---|---|---|---|
ATTRIBUTECOLLECTION | A structure containing the tag attributes | ||
URL | ![]() |
The full URL to use | |
RESOLVEURL | false | Controls if the internal links are resolved | |
REDIRECT | true | ![]() |
Automatically follow the redirects from the remote server |
GETASBINARY | false | Return the body back as a binary object | |
THROWONERROR | false | If an error occurs throw an exception | |
PORT | Override the port to connect to | ||
USERAGENT | BlueDragon | The UserAgent string to use for the request | |
METHOD | GET | The HTTP method to use | |
MULTIPART | false | Is this a multipart request | |
PROXYSERVER | The proxy server to use | ||
PROXYPORT | The port of the proxy server to use | ||
PROXYUSER | The user to user for authentication to the proxy server | ||
PROXYPASSWORD | The password to user for authentication to the proxy server | ||
USER | The user to user for authentication | ||
PASSWORD | The password to user for authentication | ||
FILE | The response will be written to the file if specified | ||
PATH | The path to the file to attach to the POST | ||
URIDIRECTORY | false | Is the file relative to the web root | |
CHARSET | The character set for the request | ||
RESULT | cfhttp | The name of the variable to get the result | |
NAME | The name of the variable to receive the query | ||
FIRSTROWASHEADERS | If receiving a CSV file, does the first line contain the headers | ||
COLUMNS | List of columns from the result CSV | ||
TEXTQUALIFIER | " | The text qualifier for the CSV | |
DELIMITER | , | The text delimiter for the CSV |
Extra
You can use CFHTTP to download large files very efficiently without having to download the file into memory and instead go straight to the disk. You can specify this using the PATH/FILE attributes. When you do this, the 'cfhttp.filecontent' will contain the full path of the downloaded file.
<cfhttp url="http://www.openbd.org/manual/sd_openBD_32.png" file="logo.png" path="#ExpandPath(".")#"></cfhttp>