Skip to main content
Known Participant
September 22, 2010
Answered

get the HTTP command parameter in cfml

  • September 22, 2010
  • 1 reply
  • 1540 views

How to get the HTTP command parameter in cfml?

e.g.

if the HTTP command is

GET /DATA/pg/index.cfm?lang=en HTTP/1.1

then the parameter should be

lang=en

if the HTTP command is

GET /DATA/pg/index.cfm?lang=fr HTTP/1.1

then the parameter should be

lang=fr

This topic has been closed for replies.
Correct answer JR__Bob__Dobbs

Try creating a file named "cgitest.cfm" with the content:

<cfoutput>#cgi.query_string#</cfoutput>

Browse to http://localhost/cgitest.cfm?lang=en  (or substitute the appropriate path on your server).

The fact that HTTP_REFERER is populated makes me suspect that you have some redirection code, such as CFLOCATION, in your index.cfm file.

1 reply

Inspiring
September 22, 2010

I think that cgi.query_string is what you're looking for.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7785.html

albertkaoAuthor
Known Participant
September 22, 2010

I put
<cfdump var="#cgi#">
<cfdump var="#http#">
<cfdump var="#url#">
in index.cfm.


HTTP_REFERER returns
/DATA/pg/index.cfm?action=edit

QUERY_STRING returns
action=edit

I do not see "lang=en" anywhere.

JR__Bob__DobbsCorrect answer
Inspiring
September 22, 2010

Try creating a file named "cgitest.cfm" with the content:

<cfoutput>#cgi.query_string#</cfoutput>

Browse to http://localhost/cgitest.cfm?lang=en  (or substitute the appropriate path on your server).

The fact that HTTP_REFERER is populated makes me suspect that you have some redirection code, such as CFLOCATION, in your index.cfm file.