酒吧专用打碟dj网站【320kpbs】高音质音乐 接口

只能这个站www.djoffice.cn

成功code 为1100 失败则是1000有带返回信息

函数自己改吧

<?php
//陈数牛逼
header("Access-Control-Allow-Origin: *");
header("Content-type:text/html;charset=utf-8");
echo csnb($_REQUEST["url"]);
function csnb($music_url) {
    try {
        if (strpos($music_url, "www.djoffice.cn") > 0) {
            $curl = curl_init();
            curl_setopt_array($curl, array(
                CURLOPT_URL => $music_url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_ENCODING => "",
                CURLOPT_MAXREDIRS => 10,
                CURLOPT_TIMEOUT => 0,
                CURLOPT_FOLLOWLOCATION => true,
                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
                CURLOPT_CUSTOMREQUEST => "GET",
                CURLOPT_HTTPHEADER => array() ,
            ));
            $response = curl_exec($curl);
            curl_close($curl);
            $resArr = [];
            preg_match('/url=\"(.*?)\"><\/a>/', $response, $resArr);
            if (!isset($resArr[0])) {
                throw new Exception("找不到");
            }
            return json_encode(["code" => 1100, "mp3_url" => "http://www.djoffice.cn" . $resArr[1]]);
        } else {
            throw new Exception("不是在www.djoffice.cn下的");
        }
    }catch(Exception $e) {
        return json_encode(["code" => 1000, "error_msg" => $e->getMessage()]);
    }
}

使用方法 “”

传到个php空间 然后 http://你的域名/你保存的文件名.php?url=djUrl

分享到:
赞(0)