GetHttpRequestData

Description

Makes HTTP request headers and body available to CFML pages. Does not take arguments. Returns a ColdFusion structure. GetHttpRequestData is especially useful for capturing SOAP request data, which can be delivered in an HTTP header.

Category

System functions

Syntax


GetHttpRequestData() 

Usage

The structure returned by GetHttpRequestData contains the following entries:
Variable Name
Description
headers
A structure that contains the HTTP Request Headers as value pairs. This includes custom headers, such as SOAP requests.
content
Raw content from the form submitted by the client, in string or binary format. For content to be considered string data, the FORM request header "CONTENT_TYPE" must start with "text/" or be special case "application/x-www-form-urlencoded". Other types are stored as a binary object.
method
A string that contains the CGI variable Request_Method
protocol
A string that contains the Server_Protocol CGI variable


Note

Use IsBinary(x.content) to determine whether data is binary, and toString(x.content) to convert data to a string value, if it can be displayed as a string.


Example

This example code shows how GetHttpRequestData can be used to return HTTP header information.

<cfset x = GetHttpRequestData()>


<cfoutput>

<table cellpadding = "2" cellspacing = "2">

  <tr>

  <TD><b>HTTP Request item</b></td>

  <td><b>Value</b></td>

  </tr>



<cfloop collection = #x.headers# item = "http_item">

  <tr>

  <td>#http_item#</td>

  <td>#StructFind(x.headers, http_item)#</td>

  </tr>

</cfloop>



<tr>

  <td>request_method</td>

  <td>#x.method#</td>

</tr>

<tr>

  <td>server_protocol</td>

  <td>#x.protocol#</td>

</tr>

</table>

<b>http_content --- #x.content#</b>

</cfoutput>



Banner.Novgorod.Ru