hi!
I've been searching for some php code which will allow me to encode my parameter information in the slash / format instead of using the ? query string:
So take the URL from:
'http://www.server.com/page.php?id=14&this=that'
Can be written as:
'http://www.server.com/page.php/id/14/this/that'
And this script will decode the parameter info $id and $this in our case.
Heres the script:
<?php
//This only works with apache module.
$HTTP_TEMP_PATH_VARS = explode("/",$PATH_INFO);
array_shift($HTTP_TEMP_PATH_VARS);
reset($HTTP_TEMP_PATH_VARS);
$HTTP_PATH_VARS = array();
while( list($index,$key) = each($HTTP_TEMP_PATH_VARS) ) {
list($index,$val) = each($HTTP_TEMP_PATH_VARS);
$val = urldecode($val);
$HTTP_PATH_VARS[$key] = $val;
$$key = $val;
}
?>
The only problem is I am developing my code on a IIS machine - my host runs Apache - as the code says, it requires an Apache module for it to work,
I was just wondering if anyone else knows of any other method to achieve the same thing so I can use it on IIS too?
Thanks