Decoding a URL without decoding values

From: Date: Sun, 21 Mar 2004 16:03:15 +0000
Subject: Decoding a URL without decoding values
Groups: php.general 
Request: Send a blank email to php-general+get-181085@lists.php.net to get a copy of this message
I've got a querystring that looks like this: ?url=http%3A%2F%2Ftest.alpharetta.ga.us%2Findex.php%3Fm%3Dlinks%26category%3DRecreation%2B%2526%2BParks%26go.x%3D22%26go.y%3D7 As you can gather, I'm trying to pass a URL to another script for some processing. Before I urlencode() the URL and pass it to the query string, it looks like this: http://test.alpharetta.ga.us/index.php?m=links&category=Recreation+%26+Parks&go.x=22&go.y=7 As you can see, there are already encoded entities in the URL, which are further encoded when passed through urlencode(). The problem I'm having is that when I urldecode() the string from $_GET["url"], I get the following string: http://test.alpharetta.ga.us/index.php?m=links&category=Recreation & Parks&go.x=22&go.y=7 It's similar, but the category variable is now "Recreation & Parks" when it needs to be "Recreation+%26+Parks". When I try to use file_get_contents() on this string, I get nothing because of the ampersand and spaces in the URL. Is there a way to urldecode() $_GET["url"] and still retain its original encoded entities so that I can use it again as a valid URL? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey

« previous php.general (#181085) next »