Welcome to WebmasterWorld Guest from 107.20.72.188

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Can I access GET data with XML?

need to access GET data

     
10:00 pm on Sep 4, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 4, 2009
posts: 2
votes: 0


Hi Forum,

Newbie XML programmer here. Can I access a variable passed along on the URL with XML? I have been scowering the web and this forum but, cannot find an answer to this so, I am guessing it is not possible?

IE: I want to get the value of the CategoryID variable below

http://www.example.com/category.xml?CategoryID=24

How can I grab that CategoryID and dereference it?

Thanks very much for the help.

[edited by: httpwebwitch at 11:03 pm (utc) on Sep. 4, 2009]
[edit reason] examplified the example [/edit]

10:23 pm on Sept 4, 2009 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator mack is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:June 15, 2001
posts:7564
votes: 4


I think this would be more a case of what you are using to output your XML file. For example, to most of us an XML file is simply a text file with a markup, but it can be dynamic. A fairly common way of doing this is to have your XML file generated using php or another scripting language. Then you can set up the server using htaccess to handle .xml in the same way it would handle .php

With a php page you can simply GET the contents from the url, and use it within your page. What you would then do is echo the contents of the file in an xml format. Then when a user or XML reader accesed the page all they would see would be the XML. Even although the XML is generated using php code, and is a dynamic php page.

Mack.

10:54 pm on Sept 4, 2009 (gmt 0)

New User

5+ Year Member

joined:Sept 4, 2009
posts: 2
votes: 0


Hi Mack,

Actually, this is straight XML that is being generated through a CMS that my company uses. We are using XSL to pretty it up for the web and transform it into HTML but the underlying code is XML.

I am working on some dynamic portions and know PHP very well. I am just starting to learn XML and wanted to know if I could grab the GET variables like I can in PHP.

5:28 pm on Sept 9, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 3, 2003
posts:792
votes: 0


You can use javascript to get at the URL of the current document. So use your XSL to render a bit of javascript into the HTML.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members