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
pathandfileparameters 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
urlparameter, then you should indicate the logical path with thepathparameter. For example, if the resource is “http://www.remotedomain.com/logicalPath/page.cfm”, and you use the value “http://www.remotedomain.com” for theurlparameter, then you should setpathto “/logicalPath”.-
file The filename of the requested resource when you do not include it in the
urlparameter. For example, if the resource is “http://www.remotedomain.com/logicalPath/page.cfm”, and you use the value “http://www.remotedomain.com/” for theurlparameter, then you should setfileto “path.cfm”.-
username
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access