grabbing string from URL if URL is masked/forwarded
| From: | Ryan Schefke | Date: | Fri, 21 May 2004 20:16:34 +0000 |
| Subject: | grabbing string from URL if URL is masked/forwarded | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186717@lists.php.net to get a copy of this message | ||
I've tried this code and it works wonders.
$string = "/tgwedding/users/client1/sites/testgrabid.php";
$thisarray = explode("/", $string);
foreach($thisarray as $item) {
if(ereg('client', $item)) {
$found = $item;
$num = ereg_replace('client', '', $found);
}
}
echo $num;
/////////////////////////// the above script will echo "1" from the string
(plan to substitute that string with $PHP_SELF
But I'm wondering if it will work when I setup a domain name with a
registrar and have that domain name MASKED and FORWARDED to a URL directory
that contains "/tgwedding/users/client1/sites/testgrabid.php".
Will this still work or will it not detect the "client1" in the string
because the URL is masked/forwarded.
I guess the question is with $PHP_SELF too....when you echo $PHP_SELF in a
script that is run from a masked domain name will it echo the real directory
URL or the masked one.
Thanks,
Ryan