User Guide

CF.http 1107
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 34, “Using Server-Side
ActionScript” in ColdFusion MX Developer’s Guide.
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";
result = CF.http({method:"post", url:url, username:"karl", password:"salsa",
resolveurl:true, params:params, path:path, file:file});
if (result)
return result.get("Statuscode");
return null;
}
// Example of a basic HTTP GET operation
// Shows that HTTP GET is the default
function basicGet()
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