php encryption


hi guys, i must to solve a problem but i don’t know where i should start

i need to encrypt an url :,shardbypass,cmbypass,id,itag,source,ip,ipbits,expire&signature=9502110CBD5EB672BEFED7A42BB71A1A0040EA3F.AF8F7074D3EA1B7EF034923F51B139F96E1EB386&key=lh1&cpn=o641DPR2ifWhwWA1&c=web&cver=html5 that will be played through jwplayer.

that url is a redirector of google so if you click you will see i need to have something like that i have found browsing on google:

http://r20— etc etc…

so what type of snippet should i put in my html file to have a similar result?

thanks again


Do you actually need it encrypted or just encoded? You can use base64 encode and decode if you dont need actual encryption.


ok thanks for your quick response as you have understand i’m new in this things so how i can do the “hiding” of that url, i need to put this in html file that play a jwplayer

so i want hide/encrypt/obfuscate/encode i don’t know what is the best practice the file link and put something this:


can you suggest me how?


i should to encrypt that url i see a lot of base64 url encoder i think that teh sample is encrypted can you suggest how to do? i want to put a code snippet (that i will obscure in JS) inside the html file.



can you suggest me how?

I told you how. Did you not even look it up?


thanks for your suggest on how to use, but ,forgive me, i’m newbie in that things so can u help me on how to build the snippet of code to do that?

I found this through your link

function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), ‘+/’, ‘-_’), ‘=’);

function base64url_decode($data) {
return base64_decode(str_pad(strtr($data, ‘-_’, ‘+/’), strlen($data) % 4, ‘=’, STR_PAD_RIGHT));

but i don’t know how to build in fact the code that i need, i don’t waste your time Sir, so i need step by step to understand if u can guide me.

thanks again


Your answer is in the first search result.

Example #1 base64_encode() example

$str = ‘This is an encoded string’;
echo base64_encode($str);

The above example will output:


To use the function you posted:

echo base64url_encode($str);
echo base64url_decode($str);



so i put that function and i replace this ‘This is an encoded string’ with my original url and in jwplayer
file : i call the "echo base64url_decode($str) " function is correct?



ok i have solved, thank you very much