RagingEagle Posted October 6, 2006 Share Posted October 6, 2006 For my website I need to take the following URL:http://www.mysite.com/index.php&db_id=2&filename=3.zipAnd 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 Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 6, 2006 Share Posted October 6, 2006 Take a look at the functions [url=http://us2.php.net/parse_url]parse_url()[/url] and [url=http://us2.php.net/parse_str]parse_str()[/url]. They should do what you want.Ken Quote Link to comment Share on other sites More sharing options...
Skatecrazy1 Posted October 6, 2006 Share Posted October 6, 2006 Also, you could just use the $_REQUEST variable and do something like this:[code]$file = $_REQUEST['filename'];include($file);[/code]as long as the file you're working with is in the same directory as the referer. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 6, 2006 Share Posted October 6, 2006 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 Quote Link to comment Share on other sites More sharing options...
RagingEagle Posted October 6, 2006 Author Share Posted October 6, 2006 [quote author=kenrbnsn link=topic=110657.msg447767#msg447767 date=1160109888]Take a look at the functions [url=http://us2.php.net/parse_url]parse_url()[/url] and [url=http://us2.php.net/parse_str]parse_str()[/url]. They should do what you want.[/quote]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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.