Page 1 of 1

I need $_Get WITHOUT automatic urldecode

Posted: Sun Nov 16, 2003 3:54 pm
by knnknn
I call a script...

aaa.com/script.php?id=xxxxxxx

...and I need to get the xxxxxxx part with $_GET['id'] BUT WITHOUT automatic urldecode.

In other words: I want to keep all the %2f and %3a etc. inside the xxxxxxx

Is that possible?

No, urldecode($_get) is not possible, because the xxxxxx part has been scrambled and a urldecode would give unpredictable results.

Posted: Sun Nov 16, 2003 3:58 pm
by infolock
this should help :

viewtopic.php?t=14226

Posted: Sun Nov 16, 2003 4:13 pm
by knnknn
Are you sure that the problem is related?

Posted: Sun Nov 16, 2003 4:25 pm
by infolock
it grabs the information from the URL, searches a database for anything that matches whatever you chose to grab from that url, and then posts what you want.

unless you don't want to query a database, then you can just post whatever it is or do whatever it is with the resulting variable you want.

but yeah, the problem is related :)

Posted: Sun Nov 16, 2003 4:27 pm
by knnknn
But it grabs it with $_get which produces the "faulty" decoded results, that I don't want.

Posted: Sun Nov 16, 2003 4:31 pm
by RTT
infolock wrote:
but yeah, the problem is related :)
No it isn't ;)

Would urlencode work? As in, to re-encode it?

Code: Select all

<?php

$_GET['blah'] = urlencode($_GET['blah']);

echo $_GET['blah'];

?>
When i enter ?blah=hello@something,&ahhsah it returns a nicely formatted string, is that what you're after?
%3Fblah%3Dhello%40something%2C

Posted: Sun Nov 16, 2003 4:44 pm
by knnknn
RTT wrote:Would urlencode work? As in, to re-encode it?
Nope, because the xxxxxxxx is scambled with random characters inserted etc.

But I think I found a solution by utilizing
$URL = $_SERVER['QUERY_STRING'];
instead of $_get.

Posted: Sun Nov 16, 2003 11:06 pm
by infolock
oops, i guess it would help if i read the question more carefully :oops:

Posted: Mon Nov 17, 2003 2:38 pm
by RTT
knnknn wrote:
RTT wrote:Would urlencode work? As in, to re-encode it?
Nope, because the xxxxxxxx is scambled with random characters inserted etc.
Ah right, sorry :) Didn't understand the first time round what you meant by scrambled :roll: :oops: