I need $_Get WITHOUT automatic urldecode

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
knnknn
Forum Newbie
Posts: 4
Joined: Sun Nov 16, 2003 3:54 pm

I need $_Get WITHOUT automatic urldecode

Post 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.
Last edited by knnknn on Sun Nov 16, 2003 4:18 pm, edited 1 time in total.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

this should help :

viewtopic.php?t=14226
User avatar
knnknn
Forum Newbie
Posts: 4
Joined: Sun Nov 16, 2003 3:54 pm

Post by knnknn »

Are you sure that the problem is related?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post 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 :)
User avatar
knnknn
Forum Newbie
Posts: 4
Joined: Sun Nov 16, 2003 3:54 pm

Post by knnknn »

But it grabs it with $_get which produces the "faulty" decoded results, that I don't want.
RTT
Forum Commoner
Posts: 38
Joined: Thu Jul 17, 2003 10:22 am
Location: Wolverhampton, UK
Contact:

Post 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
User avatar
knnknn
Forum Newbie
Posts: 4
Joined: Sun Nov 16, 2003 3:54 pm

Post 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.
Last edited by knnknn on Mon Nov 17, 2003 1:31 am, edited 1 time in total.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

oops, i guess it would help if i read the question more carefully :oops:
RTT
Forum Commoner
Posts: 38
Joined: Thu Jul 17, 2003 10:22 am
Location: Wolverhampton, UK
Contact:

Post 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:
Post Reply