User Guide
804 Chapter 7: ColdFusion ActionScript Functions
You access these attributes using the get function:
function basicGet()
{
url = "http://localhost:8100/";
// Invoke with just the url. This is an HTTP GET.
result = CF.http(url);
return result.get("Filecontent");
}
Note: For more information on using server-side ActionScript, see Chapter 30, “Using Server-Side
ActionScript,” of Developing ColdFusion MX Applications.
Example
The following examples show a number of the ways to use the CF.http function:
function postWithNamedArgs()
{
// Set up the array of Post parameters.
params = new Array();
params[1] = {name:"arg1", type:"FormField", value:"value1"};
params[2] = {name:"arg2", type:"URL", value:"value2"};
params[3] = {name:"arg3", type:"CGI", value:"value3"};
url = "http://localhost:8100/";
path = application.getContext("/").getRealPath("/");
file = "foo.txt";
Header Raw response header. For example, macromedia.com returns the following
header:
HTTP/1.1 200 OK
Date: Mon, 04 Mar 2002 17:27:44 GMT
Server: Apache/1.3.22 (Unix) mod_perl/1.26
Set-Cookie: MM_cookie=207.22.48.162.4731015262864476;
path=/; expires=Wed, 03-Mar-04 17:27:44 GMT;
domain=.macromedia.com
Connection: close
Content-Type: text/html
Filecontent File contents, for text and MIME files.
Mimetype MIME type. Examples of MIME types include text/html, image/png, image/
gif,video/mpeg, text/css, and audio/basic.
responseHeader Response header. If there is only one header key, its value can be accessed as
simple type. If there are multiple header keys, the values are put in an array in a
responseHeader structure.
Statuscode HTTP error code and associated error string. Common HTTP status codes
returned in the response header include:
400: Bad Request
401: Unauthorized
403: Forbidden
404: Not Found
405: Method Not Allowed
Property Description