湖南站长论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 756|回复: 0

百度网盘外链转换直链工具 PHP源码

[复制链接]
发表于 2013-9-21 22:35:53 | 显示全部楼层 |阅读模式

帖子内包含图片,需登陆后查看高清大图

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
国内网盘竞相扩容,不断满足网友文件存储需求,下面代码可以转换百度网盘分享文件直接外链下载,更方便在论坛或个人博客中分享你的下载文件.
使用:复制下面2段代码,第一段保存为html文件,第二段保存为baidupan.php文件,上传自己的空间个人php网站上.
分享文件后缀可自定义。
演示:http://www.zairun.com/wangpan/

[HTML] 纯文本查看 复制代码
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus&#174;">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>百度网盘文件永久外链</title>
  <link  href="http://libs.baidu.com/bootstrap/2.0.4/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen" />
  <style type="text/css">
            body {
                padding-top: 40px;
                padding-bottom: 40px;
                background-color: #f5f5f5;
            }
            .form_pan {
                max-width: 650px;
                padding: 19px 29px 29px;
                margin: 0 auto 20px;
                background-color: #fff;
                border: 1px solid #e5e5e5;
                -webkit-border-radius: 5px;
                -moz-border-radius: 5px;
                border-radius: 5px;
                -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
            }
            .form_pan .form_pan-heading {
                margin-bottom: 10px;
            }
  </style> 
</head>
 
<script type="text/javascript">
        function Change()
        {    
                    var host = window.location.host;    
                    var url = document.getElementById("text1").value;
                    var arr = url.split("&");
                    var shareid = arr[0].split("=")[1];
                    var uk = arr[1].split("=")[1];
                var file_value = "";
                    var file_type = document.getElementsByName("file_type");
                    for (var i = 0; i < file_type.length; i++) {
                    if (file_type[i].checked) {
                        file_value = file_type[i].value;
                        break;
                    }
                };
        var file_other = document.getElementById("file_other");
            file_other_text = document.getElementById("file_other_text");
        if (file_value == 'other') {
                    if (file_other_text.value.length == 0) {
                        alert("扩展名不能为空!");
                        inputUrl.focus();
                        return false;
                         }
                        //outputUrl.value = hostname + abc + "." + file_other_text.value;
                        var songurl = "http://"+host+"/baidupan.php/"+shareid+"/"+uk + "."+file_other_text.value;
                        document.getElementById("text2").value = songurl;
                            } else {
                                    //outputUrl.value = hostname + abc + "." + file_value;
                                var songurl = "http://"+host+"/baidupan.php/"+shareid+"/"+uk+"." + file_value;
                                document.getElementById("text2").value = songurl;
                     }
 
            //var songurl = "http://linuxlib.org/baidupan.php/"+shareid+"/"+uk+".mp3";
            //document.getElementById("text2").value = songurl;
        }
        function fileOtherTextChange() {
                if (file_other.checked == true) {
                    file_other_text.disabled = false;
                    file_other_text.focus();
                } else {
                    file_other_text.disabled = true;
                }
            }
</script>
 
<body>
     <div class='container'>
            <form class="form_pan" id="pan_form">
                <h2 class="form_pan-heading">百度网盘文件永久外链</h2><p>
 
                    分享地址:<input id="text1" type="TEXT" value="" style="width:550px;" size=""/><br />
                    外链地址:<input id="text2" type="TEXT" value="" style="width:550px;" size=""/><br />
        <p>
                    文件的扩展名:
                    <input type="radio" class="radio" name="file_type" id="file_mp3" value="mp3" checked />
                    mp3
                    <input type="radio" class="radio" name="file_type" id="file_png" value="png" />
                    png
                    <input type="radio" class="radio" name="file_type" id="file_exe" value="exe" />
                    exe
                    <input type="radio" class="radio" name="file_type" id="file_zip" value="zip" />
                    zip
                    <input type="radio" class="radio" name="file_type" id="file_mp4" value="mp4" />
                    mp4
                    <input type="radio" class="radio" name="file_type" id="file_other" value="other" />
                    其他格式
                    <input type="text" class="input-medium search-query" style="width:80px;" id="file_other_text" disabled />
                </p>
            <input type="BUTTON" value="转换"/>
      </div>
</body>
</html>


首先复制下面的php代码,另存为文件baidupan.php,然后将php文件放到网站根目录。
游客,本帖隐藏的内容需要积分高于 2 才可浏览,您当前积分为 0

本文转载自 载润的博客



                               
登录/注册后可看大图
该贴已经同步到 湖南站长站的微博
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|湖南站长论坛

GMT+8, 2024-5-6 03:18 , Processed in 0.202452 second(s), 9 queries , Gzip On, MemCached On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表