Method of converting url to Xunlei thunder resource download address by php

  • 2021-07-26 07:15:04
  • OfStack

This article describes the example of php implementation of url to Thunderbolt thunder resource download address method. Share it for your reference. Specific methods are analyzed as follows:

If you know the generation rules of Thunderbolt address, you don't think Thunderbolt's url resource download address is so complicated.

In fact, the address of Ray is the original url with AA in front and BB behind, and then base64_encode coding

As shown in the following example:

<?php
function Thunder($url, $type='en') {
$url ='https://www.ofstack.com';
if($type =='en'){
return "thunder://".base64_encode("AA".$url."ZZ");
}else{
return substr(base64_decode(substr(trim($url),10)),2,-2);
}
}
$url ='https://www.ofstack.com';
echo Thunder($url);
?>

Output:
thunder://QUFodHRwOi8vd3d3LmpiNTEubmV0Wlo=

I hope this article is helpful to everyone's php programming.


Related articles: