获取蓝奏云直链 - OOOPN'S API

# 获取蓝奏云直链API请求方式 #
  • Method: GET/POST

# 请求地址 #
  • https://api.ooopn.com/lanzou/api.php

# 请求参数 #
  • url                 //蓝奏云链接(必填)
  • pwd              //蓝奏云密码(选填)
  • type=down  //文件直接下载(选填)

# 返回参数 #
  • code          //状态码,200-查询成功,201-未填链接,202-解析失败,203-未填密码,400-链接失效
  • name         //获取的文件名
  • downUrl    //获取的直链
  • msg           //错误状态

# 调用示例 #

# 返回数据 #
  • {
        "code": 200,
        "name": "sssam.com_MyDraw v3.9.0.zip",
        "downUrl": "https://vip.d0.baidupan.com/file/?BmBVa11sBDUJAFNrCz4CblBvUmpecgJzAHRVMlBhUH8IawA4CzsACwAbUH9WRgFyBD9VJwV6UycDNwQsUTRVegY2VSxdegQ5CS9TIws5AmpQZlIyXl4CaQBjVW5QO1BgCD8AYgtmAGAAYVAgVmQBcwRjVWUFYlNpAzMEO1E7VWEGMlUkXXAEIAliUzcLbwIyUDNSeF4xAjIAKFVhUDlQfghtADYLNAAwADVQZFZmATcEZlU0BThTZwNlBDdRaFUwBmBVNl05BGYJO1NnCzsCYlA+UjFeYAIwADFVa1BvUGQIJgAtCz8AJABwUHNWcQFlBCxVOQU+U2wDMQQzUT5VbQY/VTtdJgQkCTZTaAs6AmVQN1JmXjQCNQAzVWdQPFBlCDoAYwtvAHoAeA=="
    }

# PHP调用 #
  • <?php
    header("Access-Control-Allow-Origin:*");
    date_default_timezone_set("PRC");
    $url = $_GET['url'];
    $result = file_get_contents("https://api.ooopn.com/lanzou/api.php?url=".$url);
    $arr = json_decode($result,true);
    if ($arr['code']==200) {
        header("Content-Type:application/json;charset=UTF-8");
        //输出直链时,改成 $arr['downUrl']
        echo json_encode($arr,JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);           
    } else {
        header("Content-Type:text/html;charset=UTF-8");
        echo $arr['msg'];
    }
    ?>
    注:将以上PHP代码保存成api.php上传至服务器,即可制作自己的API接口