Is urlencode possible url containing url encoded by url?

I have a website that uses facebook, twitter, delicious share links. They contain the URL encoded by the URL of the website you want to share. The problem is that I want to send facebook / twitter / delicious url via php redirect page.

Will it work to encode a url in an encoded url? Will there be side effects?

To simplify my question:

www.website.com/redirect.php?url=" URLENCODED (http://www.facbook.com/sharer.php?t='URLENCODED(title)'&u='URLENCODED(http://www.hotel.com)')
+5
source share
5 answers

You can encode a string several times with percent encoding and get the original value by decoding it as many times:

$str = implode(range("\x00", "\xFF"));
var_dump($str === urldecode(urldecode(urldecode(urlencode(urlencode(urlencode($str)))))));

$str , . $str.

, :

'http://example.com/redirect.php?url='.urlencode('http://www.facbook.com/sharer.php?t='.urlencode('title').'&u='.urlencode('http://www.hotel.com'))
+9

URL , . /, :

0: /
1: %3F
2: %%3F
3: %%%%3F

.

+3

URLEncoding. URLEncoding , , . script urlencode() .

, , urlencoded, ? urlencoding.

+1

urldecode URL-, urlencode .

0

As mentioned earlier, you can encode URLs as much as you want, but you should know that the more times you encode url data, the more it will increase in length, maybe twice. which will annoy users if it is too long. There may also be a limit on the length of the URL in some browsers. Also on the server side there will be overhead coding and decoding of data. In short, you really have to be sure that you need this several times before encoding / decoding.

0
source

All Articles