Universeman Posted February 22, 2010 Share Posted February 22, 2010 Hey everyone, I seem to have a slight problem with handling URL variables when using GET on a form. My PHP script takes an input from the user in the form of a url. As it gets passed to itself, the URL becomes malformed (but the scrpit works just fine). Example: User input in an input named 'url': http://www.google.com/ URL output after execution via GET: http://www.mysite.com/?url=http%3A%2F%2Fwww.google.com%2F What I really want is this to show up in the URL instead: http://www.mysite.com/?url=http://www.google.com/ How can I accomplish this? Link to comment https://forums.phpfreaks.com/topic/192900-url-variables/ Share on other sites More sharing options...
jl5501 Posted February 22, 2010 Share Posted February 22, 2010 The url you are seeing, has been urlencoded. You would need to urldecode the received urlstring to convert it back Link to comment https://forums.phpfreaks.com/topic/192900-url-variables/#findComment-1015974 Share on other sites More sharing options...
Universeman Posted February 22, 2010 Author Share Posted February 22, 2010 Well, I'm already doing that for my script execution. However, what I'm getting at is how can I make the address bar in the browser show up with urldecoded URL instead of the urlencoded one (basically making it look cleaner). Link to comment https://forums.phpfreaks.com/topic/192900-url-variables/#findComment-1015976 Share on other sites More sharing options...
jl5501 Posted February 22, 2010 Share Posted February 22, 2010 There are certain characters that are not allowed in urls, and that is why these characters are sent urlencoded. see http://www.blooberry.com/indexdot/html/topics/urlencoding.htm Link to comment https://forums.phpfreaks.com/topic/192900-url-variables/#findComment-1015978 Share on other sites More sharing options...
Universeman Posted February 22, 2010 Author Share Posted February 22, 2010 I see. Okay, how about this... I take their URL input and use base64_encode it. Using method="get", how can I get the address bar to show: http://www.mysite.com/?url=aHR0cDovL3d3dy5nb29nbGUuY29tLw== ... when the user inputs: http://www.google.com/ Link to comment https://forums.phpfreaks.com/topic/192900-url-variables/#findComment-1015979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.