Http()

The Http function allows you to interact with remote HTTP sites, from simply downloading a file, to submitting form data. Returns back the CFHTTP structure

Usage

STRUCTURE = Http( url, resolveurl, redirect, getasbinary, throwonerror, port, useragent, method, multipart, timeout, proxyserver, proxyport, proxyuser, proxypassword, user, password, file, path, uridirectory, charset, result, name, firstrowasheaders, columns, textqualifier, delimiter, httpparams, clientcert )
Argument Summary
url The full URL to request
resolveurl A boolean to indicate whether internal links are resolved [optional]
redirect A boolean to indicate whether to automatically follow the redirects from the remote server [optional]
getasbinary A boolean to indicate whether to return the body back as a binary object - valid values are AUTO, YES and NO [optional]
throwonerror A boolean to indicate whether an exception should be thrown if an error occurs [optional]
port Set the port to connect to. Defaults to 80. [optional]
useragent The UserAgent value to use for the request [optional]
method The HTTP method to use. Defaults to GET [optional]
multipart A boolean to indicate whether this a multipart request in the case where the method is POST [optional]
timeout The number of seconds to wait before timing out the request [optional]
proxyserver The proxy server to use [optional]
proxyport The port of the proxy server to use [optional]
proxyuser The username for authentication against the proxy server if required [optional]
proxypassword The password for authentication against the proxy server if required [optional]
user The username if basic authentication is required [optional]
password The password if basic authentication is required [optional]
file If specified, the response will be written to the file for the given path [optional]
path The path to the file to upload with a POST [optional]
uridirectory A boolean to indicate whether the file path is relative to the web root [optional]
charset The character set of the response [optional]
result The name of the variable to set the result [optional]
name The name of the variable to set the query if the response should be treated as CSV [optional]
firstrowasheaders If reading the response as CSV, this boolean indicates whether the first line contain the headers [optional]
columns If reading the response as CSV, the list of columns from the result CSV. The column count has to be the same as the column count in the original data [optional]
textqualifier If reading the response as CSV, the text qualifier to use in parsing it [optional]
delimiter If reading the response as CSV, the text delimiter to use in parsing it [optional]
httpparams Array of structures {type, value, encoded, url, formfield, cgi, header, cookie, file, mimetype} representing the attributes of CFHTTPPARAM [optional]
clientcert The file path to the client certificate to use for a secure connection [optional]

Calling

Supports named-parameter calling allowing you to use the function like:

Http(
   url=?, 
   resolveurl=?, 
   redirect=?, 
   getasbinary=?, 
   throwonerror=?, 
   port=?, 
   useragent=?, 
   method=?, 
   multipart=?, 
   timeout=?, 
   proxyserver=?, 
   proxyport=?, 
   proxyuser=?, 
   proxypassword=?, 
   user=?, 
   password=?, 
   file=?, 
   path=?, 
   uridirectory=?, 
   charset=?, 
   result=?, 
   name=?, 
   firstrowasheaders=?, 
   columns=?, 
   textqualifier=?, 
   delimiter=?, 
   httpparams=?, 
   clientcert=?
);

Supports passing parameters as a structure using ArgumentCollection:

Http( ArgumentCollection={
   url : ?, 
   resolveurl : ?, 
   redirect : ?, 
   getasbinary : ?, 
   throwonerror : ?, 
   port : ?, 
   useragent : ?, 
   method : ?, 
   multipart : ?, 
   timeout : ?, 
   proxyserver : ?, 
   proxyport : ?, 
   proxyuser : ?, 
   proxypassword : ?, 
   user : ?, 
   password : ?, 
   file : ?, 
   path : ?, 
   uridirectory : ?, 
   charset : ?, 
   result : ?, 
   name : ?, 
   firstrowasheaders : ?, 
   columns : ?, 
   textqualifier : ?, 
   delimiter : ?, 
   httpparams : ?, 
   clientcert : ?
} );

See Also

Http