Search code examples
phpurldecode

PHP url decode do not work


I have an URL in which parameter pass is urlencoded:

http://ipaddress/userandpass.php?user=test&pass=145Red#321OK

In order to decode this param I have tried to use urldecode and rawurldecode and utf8_decode(urldecode()) but without succes. My code looks like this:

if(isset($_GET["pass"]) && $_GET["pass"] != ""){
$pass=urldecode($_GET["pass"]);
}

Do you have any ideas about how could I solve this issue ?


Solution

  • just use

    if(!empty($_GET["pass"]))
    {
        $pass= $_GET["pass"];
    }
    

    PHP - GET & POST Methods

    http://www.test.com/index.htm?name1=value1&name2=value2
    
    • The GET method produces a long string that appears in your server logs, in the browser's Location: box.
    • The GET method is restricted to send upto 1024 characters only.
    • Never use GET method if you have password or other sensitive information to be sent to the server.
    • GET can't be used to send binary data, like images or word documents, to the server
    • The data sent by GET method can be accessed using QUERY_STRING environment variable.
    • The PHP provides $_GET associative array to access all the sent information using GET method.