PHP產生迅雷、快車、QQ旋風下載連結的執行個體

來源:互聯網
上載者:User

本文將介紹如何通過 PHP 函數處理,輕鬆產生製作各種第三方下載工具(比如迅雷,快車,QQ旋風)的下載連結資料,並直接輸出到前台上,同時也可以將轉換過的連結還原為原始的下載地址。

該功能所用到的 PHP 函數主要是下面兩個:

1. base64_encode: 用於以 base64 方式加密字串;

2. base64_decode: 用於解密以 base64 方式加密的字串。

下面直接通過樣本說明,基本都能理解,就不做詳細解釋了。

<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>PHP產生迅雷、快車、QQ旋風下載連結的方法</title></head><body><?phpfunction 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><?phpif(is_array($result)){//www.Alixixi.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>

頁面的效果如下圖:

您可能感興趣的文章

  • php擷取遠程圖片並下載儲存到本地
  • PHP 產生連續的數字(字母)數組函數range()分析,PHP抽獎程式函數
  • php大量刪除超連結
  • php常用函數收集並附解釋說明
  • php用header()實現檔案下載,下載的檔案提示被破壞不能開啟的解決辦法
  • php產生動態驗證碼圖片(gif)
  • PHP 利用 Curl Functions 實現多線程抓取網頁和下載檔案
  • php利用curl實現多線程的類,php curl多線程下載圖片


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.