I call a php script http://site.com/process.php
that takes a url as one of its parameters. for=
http://site.com/process.php?for=http://www.anotherwebsite.com
I then do this and try to parse_url()
but parse_url() gives a parse error.
$uri = $_SERVER['REQUEST_URI']; // /process.php?for=http://www.anotherwebsite.com
parse_url($uri);
How can I encode the for
parameter either on the sending side (in the url) or on the receiving side (php) so that parse_url()
understands that it's just a parameter that happens to look like a url?
Well, first you must
urlencode()
thefor=
parameter, then inprocess.php
, you can simply doHere are the functions: http://php.net/manual/en/function.urlencode.php http://php.net/manual/en/function.urldecode.php