Eugeny89
Eugeny89

Reputation: 3731

what is correct and secure vay to pass url through url

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

Answers (2)

worenga
worenga

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

Related Questions