I am retrieveing data from $_GET on page linked by:
<a class="send" href="<?php echo sendData.php?user=somebody&password=any; ?>">Send POST info</a>
locally using XAMPP with
<?php
$user = urlencode($_GET['user']);
$password = urlencode($_GET['password']);
echo '<strong>user: </strong>'.$user.' <strong>password: </strong>'.$password;
?>
and it works fine, however when encoding
<?php
$url=rawurlencode('sendData.php');
$url .= urlencode('?user=somebody&password=any');
?>
<a class="send" href="<?php echo $url; ?>">
Send POST info
</a>
The linked page access is forbidden
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
18.10.2011 ã. 23:00:31 ÷.
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
Any ideas what is messing up?
Don’t encode the entire query-string.
In your code, you’re converting the “?” and “&” and “=”.
Encode the values individually, and concatenate the values.
So
Ultimately, that’s also going to allow you to sanitize them, as well.