You use the CF.http ActionScript function to retrieve information from a remote HTTP server using HTTP Get and Post methods, as follows:
Get method, you send information to the remote server directly in the URL. This is common for a one-way transaction in which the CF.http function retrieves an object, such as the contents of a web page.
Post method can pass variables to a form or CGI program, and can also create HTTP cookies.
The most basic way to use the CF.http function is to use it with the Get method argument to retrieve a page from a specified URL. The Get method is the default for the CF.http function.
The following server-side example retrieves file content from the specified URL:
function basicGet(url)
{
// Invoke with just the url argument. This is an HTTP GET.
result = CF.http(url);
return result.get("Filecontent");
}
The client-side example could look like the following:
#include "NetServices.as"
NetServices.setDefaultGatewayUrl("http://mycfserver:8500");
gatewayConnnection = NetServices.createGatewayConnection();
myHttp = gatewayConnnection.getService("httpFuncs", this);
// This is the server-side function invocation
url = "http://anyserver.com";
myHttp.basicGet(url);
// Create the results function
function basicGet_Result()
{
url = "http://anyserver.com
ssasFile.basicGet(url)
}
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001503.htm