Reputation: 3731
I want to pass url (or even several urls) through url, i.e. use url like http://domain/file.php?url1=...&url2=...
. The question is how to make such urls safe and working. Will urlencode()
help.
BTW, if I do urlencode($url)
, do I need to urldecode()
before doing header("Location: $url")
Thank you in advance!
Upvotes: 2
Views: 158
Reputation: 5856
Will urlencode() help.
yes.
BTW, if I do urlencode($url), do I need to urldecode() before doing header("Location: $url")
no. you'd need to encode the single urls which go to the final url, i.e.
$url1= "http://www.example.com";
$final = "http://yourdomain.com?url1=".urlencode($url1);
Upvotes: 1
Reputation: 5817
My proposal is to use:
http://php.net/manual/en/function.http-build-query.php
Upvotes: 3