我的博客鏈接https://hanbaoaaa.xyz/index.php/archives/21/k.html
先來新建html
我去找找之前的模板
腳本篩選出id:
pw= document.getElementById("input-pw").value;
pw=pw.replace(/[^0-9]/ig,"");
if(pw.length<2){
alert("請輸入有效id或包含id的鏈接");
return;
}
php中請求鏈接
function curl_file_get_contents($durl){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $durl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ; // 獲取數據返回
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ; // 在啓用 CURLOPT_RETURNTRANSFER 時候將獲取數據返回
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//echo 'http://player.kuwo.cn/webmusic/st/getNewMuiseByRid?rid='.$_POST['rid'];
$data1 =curl_file_get_contents('http://player.kuwo.cn/webmusic/st/getNewMuiseByRid?rid='.$_POST['rid']);
echo explode('</mp3dl>',explode('<mp3dl>',$data1)[1])[0].explode('</mp3path>',explode('<mp3path>',$data1)[1])[0]
?>