Jump to content


Photo

Taking information out of URL


  • Please log in to reply
4 replies to this topic

#1 RagingEagle

RagingEagle
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 06 October 2006 - 03:57 AM

For my website I need to take the following URL:

http://www.mysite.co...&filename=3.zip

And get the information from filename so that I can display the text "3.zip" on my webpage. I know I can do that with Get however Get only works when it calls the information from the URL bar. The above URL is not going to be in the URL bar but rather actual code on the webpage. Is it possible to do what I want?

Thanks,
RE

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 06 October 2006 - 04:44 AM

Take a look at the functions parse_url() and parse_str(). They should do what you want.

Ken

#3 Skatecrazy1

Skatecrazy1
  • Members
  • PipPipPip
  • Advanced Member
  • 126 posts
  • LocationSouthern California

Posted 06 October 2006 - 05:15 AM

Also, you could just use the $_REQUEST variable and do something like this:

$file = $_REQUEST['filename'];

include($file);

as long as the file you're working with is in the same directory as the referer.
fuck it or fight it

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 06 October 2006 - 01:44 PM

No, the OP already said he couldn't use the $_GET array since the string in question is not coming from the URL but from a file. The $_REQUEST array is just a combination of the $_GET and $_POST arrays and would be of no use to the OP.

Ken

#5 RagingEagle

RagingEagle
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 06 October 2006 - 08:42 PM

Take a look at the functions parse_url() and parse_str(). They should do what you want.


I tried using parse_url() before I came here and it didn't work. But I didn't know about parse_str() which worked :). Thanks for the help!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users