View comments | RSS feed

GetHttpRequestData

Description

Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header.

Return value

A ColdFusion structure.

Category

System functions

Syntax

GetHttpRequestData()

Usage

The structure returned by this function contains the following entries:
Parameter Description
headers
Structure that contains HTTP request headers as value pairs. Includes custom headers, such as SOAP requests.
content
Raw content from form submitted by 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
String that contains the CGI variable Request_Method.
protocol
String that contains the Server_Protocol CGI variable.

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

The following example shows how this function can return HTTP header information.

Example

<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>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


jochemd said on Nov 18, 2002 at 4:06 PM :
GetHTTPRequestData() does not return any information about the requested resource. A standard HTTP request would look something like:
GET /admin/ HTTP/1.1

Of these, only the GET and the HTTP/1.1 will be returned by GEtHTTPRequestData(), not the /admin/.
hlichtin said on Mar 13, 2003 at 3:12 PM :
You are right that getHTTPParameters does not include the URL string as an entry. We will enter an enhancement request. You can get the information, however. The URL scope includes all query string attribute/value pairs and the CGI.SCIPT_NAME variable has the called script name.
Steve said on Dec 10, 2003 at 5:03 AM :
Was this function ever patched with CF5? I have a client running CF5 and gethttprequestdata() is returning a null value for the content section. When we run the identical code on cfmx we get a base64 string in the content section like we're expecting.
Steve said on Dec 10, 2003 at 5:04 AM :
btw, if this wasn't patched to fix this content variable null value, is there a java/c++ cfx out there that obtains this information?

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt196.htm