Not sure if my question is phrased correctly, but I want to get the current page url which for example let's say is:
http://www.mysite.com?gallery=my_pic...&place=jamaica
without any of the &'s and their values. Basically what I want is:
http://www.mysite.com?gallery=my_pics.html
Using this:
PHP Code:
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; }
return $pageURL;
returns the whole url, and I know I can use something like:
str_replace('&type=photos&place=jamaica', '', $pageURL);
before returning $pageURL but that's not a viabe option as I will sometimes have two & parameters and sometimes many more.
So is there a way to always strip all &'s and the values from a URL? (btw I still want to keep the ?something just not the &'s)
Last edited by Towhid; 03-31-2010 at 03:03 PM..
|