• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Parsing URL Variables

New Here ,
Jan 22, 2008 Jan 22, 2008

Copy link to clipboard

Copied

I have a page (not on my server) that links to a page on my server.

This URL has several variables that I want to grab and use on my page. The URL looks like this:

http://www.somedomain.org/test.cgi?id=ABC&isbn=1234&volume=82

By using cgi.HTTP_REFERER I am able to display the URL, but I am having trouble parsing out the variables to use later on the page.

How do I "grab" the values of id, isbn, and volume from this URL?

Thank you for your help.
Alison
TOPICS
Advanced techniques

Views

546

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2008 Jan 22, 2008

Copy link to clipboard

Copied

Use list functions. The url is a nested list. The outer list has an ampersand delimiter and the inner lists have an equal sign delimiter.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2008 Jan 22, 2008

Copy link to clipboard

Copied

alison@ut wrote:
> I have a page (not on my server) that links to a page on my server.
>
> This URL has several variables that I want to grab and use on my page. The
> URL looks like this:
>
> http://www.somedomain.org/test.cgi?id=ABC&isbn=1234&volume=82
>
> By using cgi.HTTP_REFERER I am able to display the URL, but I am having
> trouble parsing out the variables to use later on the page.
>
> How do I "grab" the values of id, isbn, and volume from this URL?
>
> Thank you for your help.
> Alison
>

Most of us would use url.id, url.isbn and url.volume. You could also
use url['id'], url['isbn'] and url['volume'] if you like on any version
of ColdFusion released this century.

<cfdump var="#url#"> may also be informative.

I.E. you are working to hard if you are trying to parse
cgi.http_REFERER. ColdFusion has already done this and dumped
everything into the URL structure. Of course, if I was going to use a
CGI variable, I would use cgi.query_string and parse as nested lists.

But is 'test.cgi' a ColdFusion template?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 22, 2008 Jan 22, 2008

Copy link to clipboard

Copied

Thank you both for your replies!

The referring page is not a CF page, so i guess I will need to parse the URL using cgi.query_string. I will look for information on how to do that since I have never used that before.

Thanks again!
Alison

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 22, 2008 Jan 22, 2008

Copy link to clipboard

Copied

LATEST
alison@ut wrote:
> Thank you both for your replies!
>
> The referring page is not a CF page, so i guess I will need to parse the URL
> using cgi.query_string. I will look for information on how to do that since I
> have never used that before.
>
> Thanks again!
> Alison
>

The referring page has nothing to say about this. If the page on your
server is a CFML page, then the URL variables will be in the URL
structure. ColdFusion handles this behind the scenes whenever a request
is made, no matter where the request comes from, ColdFusion doesn't care.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation