CF_HTTP
The CF_HTTP tag allows you to perform POST and GET operations related to HTTP.
Using CF_HTTP, you can perform standard GET operations. POST operations allows
you to upload MIME file types to a server, or post cookie, formfield, URL,
file, or CGI variables directly to a specified server.
See also CF_HTTPPARAM.
Syntax
<CF_HTTP URL="hostname"
PORT="port_number"
METHOD="get_or_post"
USERNAME="username"
PASSWORD="password"
PATH="path"
FILE="filename"
PROXYSERVER="hostname"
PROXYPORT="port_number"
USERAGENT="user_agent"
REFERRER="referrer"
PROTOCOL="protocol"
COOKIES="boolean"
FOLLOWREDIRECTS="boolean"
MAXREDIRECTS="max_number_of_redirects">
</CF_HTTP>
URL
Required. Full URL of the host name or IP address of the server on which the
file resides.
PORT
Optional. The port number on the server from which the object is being
requested. If no port is specified then a default port 80 is used to send
request.
METHOD
Required. GET or POST. Use GET to download a text or binary file. Use POST to
send information to a server, which allows you to upload MIME file types to a
server, or post cookie, formfield, URL, file, or CGI variables.
USERNAME
Optional. When required by a server, a valid username.
PASSWORD
Optional. When required by a server, a valid password.
PATH
Optional. The path to the directory in which a file is to be stored. If a path
is not specified in a POST or GET operation, a variable is created
(CF_HTTP.FileContent) that you can use to present the results of the GET or
POST operation in a CFOUTPUT.
FILE
Required in a POST operation if PATH is specified. The filename to be used for
the file that is accessed.
PROXYSERVER
Optional. The proxy server address.
PROXYPORT
Optional. The port number on the proxy server from which the object is being
requested. If no port is specified then a default port 80 is used to send
request.
USERAGENT
Optional. User agent request header.
REFERRER
Optional. Address of a string that specifies the address (URL) of the document
from which the URL in the request was obtained.
PROTOCOL
Optional. The protocol property indicates what version of HTTP should be used in
request. Default value is HTTP/1.0.
COOKIES
Optional. This parameter is used to set flag whether to add cookie headers to
requests or add returned cookies to the cookie database. Valid values are
-
TRUE (default)
if this parameter is set as TRUE then tag will automatically process cookies
-
FALSE if this parameter is set as FALSE then tag will
not process cookies
FOLLOWREDIRECTS
Optional. This parameter is used to follow redirect responses from the HTTP
server. Valid values are
-
TRUE (default)
if this parameter is set as TRUE then tag will automatically follow redirects
-
FALSE if this parameter is set as FALSE then tag will
not not follow any redirect
MAXREDIRECTS
Optional. This parameter is used to set maximum number of times an HTTP
redirection will be allowed. The default value is -1, which means follow all
possible redirects. This property is effective in case FollowRedirects is set
as TRUE.
Usage
Note the following:
Example
<!--- This example shows the use of CF_HTTP
to pull information from a web page --->
<HTML>
<HEAD>
<TITLE>CF_HTTP Example</TITLE>
</HEAD>
<BODY>
<H3>CF_HTTP Example</H3>
<P>This example shows the ability of CF_HTTP to pull the contents
of a web page from the Internet, and shows how you can
get the following information by using CF_HTTP variables.</P>
<CF_HTTP URL="http://www.aspfusion.net" METHOD="GET">
</CF_HTTP>
<CFOUTPUT>
CurrentURL: #cf_http.currenturl#<BR>
FileContent: #cf_http.filecontent#<BR>
MIMEType: #cf_http.mimetype#<BR>
Header: #cf_http.header#<BR>
</CFOUTPUT>
</BODY>
</HTML>