php method to convert url to thunder resource download address,
The example in this article describes the method of converting URL to Thunder resource download address in PHP. Share it with everyone for your reference. The specific method analysis is as follows:
If you know the generation rules of Xunlei address, you won’t think how complicated Xunlei’s URL resource download address is,
In fact, Lei’s address is the original url with AA in front and BB in the back and then base64_encoded
As shown in the following example:
Copy code The code is as follows:
function Thunder($url, $type='en') {
$url ='http://www.bkjia.com';
if($type =='en'){
return "thunder://".base64_encode("AA".$url."ZZ");
}else{
return substr(base64_decode(substr(trim($url),10)),2,-2);
}
}
$url ='http://www.bkjia.com';
echo Thunder($url);
?>
Output result:
thunder://QUFodHRwOi8vd3d3LmpiNTEubmV0Wlo=
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/907834.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/907834.htmlTechArticlephp method to convert url to thunder resource download address, this article describes the example of php to convert url to thunder thunder Resource download address method. Share it with everyone for your reference. ...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn