O'Reilly logo

Actionscript Cookbook by Joey Lott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

20.23. Making HTTP Requests with Server-Side ActionScript

Problem

You want to make HTTP requests using Server-Side ActionScript (SSAS).

Solution

Use the CF.http( ) method.

Discussion

The Server-Side ActionScript CF.http( ) method enables you to make HTTP requests to any resource available on the Web. This is a convenient way to run server-side scripts on remote domains and return those values to Flash.

The CF.http( ) method accepts the following parameters:

url

The URL to the requested resource (e.g., “http://www.remotedomain.com/logicalPath/page.cfm”) or the protocol and server address/domain name (e.g., “http://www.remotedomain.com/”). You may also need to specify values for the path and file parameters when you use the second format.

method

Either “post” or “get”, corresponding to the HTTP method (POST or GET) used to send any parameters.

path

If you do not include the logical path and filename in the url parameter, then you should indicate the logical path with the path parameter. For example, if the resource is “http://www.remotedomain.com/logicalPath/page.cfm”, and you use the value “http://www.remotedomain.com” for the url parameter, then you should set path to “/logicalPath”.

file

The filename of the requested resource when you do not include it in the url parameter. For example, if the resource is “http://www.remotedomain.com/logicalPath/page.cfm”, and you use the value “http://www.remotedomain.com/” for the url parameter, then you should set file to “path.cfm”.

username

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required