Re: passing variables in URL string without ?
| From: | Rouvas Stathis | Date: | Thu, 12 Oct 2000 21:01:23 +0000 |
| Subject: | Re: passing variables in URL string without ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19888@lists.php.net to get a copy of this message | ||
From an earlier post to this list:
In httpd.conf, in the <VirtualHost> block for the site:
<Location /ThisIsAProgram>
ForceType appllication/x-http-php
</Location>
In a php program file, named ThisIsAProgram in the DocumentRoot of the
site:
==========================
<?
$Params = explode( '/', $PATH_INFO );
while( list( $Index, $Value ) = each( $Params )) {
echo "Params[ $Index ] = $Value<BR>\n" );
}
?>
==========================
Hit this URL:
http://whatever.site.com/ThisIsAProgram/these/directories/are/not/real
You should get:
Params[ 0 ] =
Params[ 1 ] = these
Params[ 2 ] = directories
Params[ 3 ] = are
Params[ 4 ] = not
Params[ 5 ] = real
If you can't or don't want to do the <Location> thing, you can name the
file ThisIsAProgram.php (or .php3) and call it:
http://whatever.site.com/ThisIsAProgram.php/these/directories/are/not/re
al
But I think it is pretty cool to make the program name look like just
another directory in the tree, so I usually use <Location>.
"Rodino, Justin Bain" wrote:
>
> I think I recently saw this post, but I can't seem to find it when
> searching. I saw someone pass the URL string as:
>
> http://my.site.com/books/k12/7/3
>
> and what actually happened was books was the correct URL, but it parsed the
> k12 to be a variable (variable 0) 7 to be a variable (variable 1) and the 3
> to be a variable (variable 2). What I was wondering is how it was done...can
> anyone help?
>
> I ask because I help run a news site and I want to give the users the option
> of going to:
>
> http://my.site.com/3882
>
> where 3882 would be the news story (then from there I'd dynamically pull
> that story out of the database etc...).
>
> Thanks!
>
> ________________________________________
> Justin Rodino <justin@goldendome.com>
> Web Application Developer
> Golden Dome Media
> PO Box 1616
> Notre Dame, IN 46634
> 219.631.1116
> 800.728.7979 ext. 1116
> 219.631.1001 - fax
> http://www.goldendome.com/
> http://www.wndu.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net