Name

GetHTTPRequestData — New as of ColdFusion 5.0

Synopsis

GetHTTPRequestData(  )

Returns a structure containing the HTTP request headers and body available to the current page. This function is especially useful for parsing Simple Object Access Protocol (SOAP) requests, which are often passed in the HTTP header. The structure returned by GetHTTPRequestData( ) contains the following keys:

Headers

Structure containing all the HTTP request headers as key/value pairs.

Content

If the current page is accessed via a form post, Content contains the raw content (string or binary) of the form post; otherwise it is blank. In order to be considered string content, the value of the CONTENT_TYPE request header must be “application/x-www-form-urlencoded” or must begin with “text/”. All other content types are automatically stored as binary objects. Because of this, you should first use the IsBinary( ) function when evaluating Content. You may also consider using the ToString( ) function to convert binary data stored in Content to a string value that can then be displayed.

Method

The value contained in the Request_Method CGI variable.

Protocol

The value contained in the Server_Protocol CGI variable.

The following example demonstrates the use of the GetHTTPRequestData( ) function (try calling the template directly and via a form post to see how the Content key is populated differently):

<CFSET RequestHeader = GetHttpRequestData( )> <!--- use the CFDUMP (CF 5.0) tag to automatically generate a ...

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.