Home >Backend Development >PHP Tutorial >Examples of PHP generating download links for Thunder, Kuaiche and QQ Tornado_PHP Tutorial
This article will introduce how to easily generate and create download link data for various third-party download tools (such as Thunder, Kuaiche, QQ Tornado) through PHP function processing, and output it directly to the front desk. At the same time, you can also convert The past link will be restored to the original download address.
The PHP functions used by this function are mainly the following two:
1. base64_encode: used to encrypt strings in base64 mode;
2. base64_decode: used to decrypt strings encrypted in base64 mode.
The following will be explained directly through examples. You can basically understand it, so I won’t explain it in detail.
<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>PHP生成迅雷、快车、QQ旋风下载链接的方法</title> </head> <body> <?php function zhuanhuan($url){ if(empty($url)) return $result; $urlodd=explode('//',$url,2); $head=strtolower($urlodd[0]); $behind=$urlodd[1]; if($head=="thunder:"){ $url=substr(base64_decode($behind),2,-2); }else if($head=="flashget:"){ $url1=explode('&',$behind,2); $url=substr(base64_decode($url1[0]),10,-10); }else if($head=="qqdl:"){ $url=base64_decode($behind); }else if($head=="http:"||$head=="ftp:"||$head=="mms:"||$head=="rtsp:"||$head=="https:"){ $url=array( 'thunder'=>"thunder://".base64_encode("AA".$url."ZZ"), 'flashget'=>"Flashget://".base64_encode("[FLASHGET]".$url."[FLASHGET]")."&aiyh", 'qqdl'=>"qqdl://".base64_encode($url) ); }else{ return ''; } return $url; } $url=isset($_GET['url'])?$_GET['url']:''; $result=zhuanhuan($url); ?> <form action="" method=GET> 请输入普通链接或者迅雷,快车,旋风链地址:<br /> <input type=text name="url" size="80"> <input type=submit value="转换"> </form> <?php if(is_array($result)){//www.phpernote.com ?> <p>地址:<a href="<?php echo $url;?>" target="_blank"><?php echo $url;?></a> <p>迅雷链:<a href="<?php echo $result['thunder'];?>" target="_blank"><?php echo $result['thunder'];?></a> <p>快车链:<a href="<?php echo $result['flashget'];?>" target="_blank"><?php echo $result['flashget'];?></a> <p>旋风链:<a href="<?php echo $result['qqdl'];?>" target="_blank"><?php echo $result['qqdl'];?></a> <?php }else{ ?> <p>实际地址:<a href="<?php echo $result;?>" target="_blank"><?php echo $result;?></a> <?php } ?> </body> </html>
The effect of the page is as follows: