3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); ini_set('user_agent', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36'); header('Content-Type: text/html; charset=utf-8'); header('X-XSS-Protection: 1; mode=block'); ?> <!DOCTYPE html> <html> <head> <meta charset='utf-8'> <title>QQ无损音乐地址获取</title> <script type='text/javascript' src='jquery.min.js'></script> <script type='text/javascript' src='noreferrer.js'></script> <style> .CSSTableGenerator { margin: 0px; padding: 0px; width: 100%; box-shadow: 10px 10px 5px #888888; border: 1px solid #000000; -moz-border-radius-bottomleft: 0px; -webkit-border-bottom-left-radius: 0px; border-bottom-left-radius: 0px; -moz-border-radius-bottomright: 0px; -webkit-border-bottom-right-radius: 0px; border-bottom-right-radius: 0px; -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; border-top-right-radius: 0px; -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; border-top-left-radius: 0px; } .CSSTableGenerator table { width: 100%; height: 100%; margin: 0px; padding: 0px; } .CSSTableGenerator tr:last-child td:last-child { -moz-border-radius-bottomright: 0px; -webkit-border-bottom-right-radius: 0px; border-bottom-right-radius: 0px; } .CSSTableGenerator table tr:first-child td:first-child { -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; border-top-left-radius: 0px; } .CSSTableGenerator table tr:first-child td:last-child { -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; border-top-right-radius: 0px; } .CSSTableGenerator tr:last-child td:first-child { -moz-border-radius-bottomleft: 0px; -webkit-border-bottom-left-radius: 0px; border-bottom-left-radius: 0px; } .CSSTableGenerator tr:hover td { } .CSSTableGenerator tr:nth-child(odd) { background-color: #aad4ff; } .CSSTableGenerator tr:nth-child(even) { background-color: #ffffff; } .CSSTableGenerator td { vertical-align: middle; border: 1px solid #000000; border-width: 0px 1px 1px 0px; text-align: left; padding: 7px; font-size: 15px; font-family: Arial; font-weight: normal; color: #000000; } .CSSTableGenerator tr:last-child td { border-width: 0px 1px 0px 0px; } .CSSTableGenerator tr td:last-child { border-width: 0px 0px 1px 0px; } .CSSTableGenerator tr:last-child td:last-child { border-width: 0px 0px 0px 0px; } .CSSTableGenerator tr:first-child td { background: -o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f)); background: -moz-linear-gradient(center top, #005fbf 5%, #003f7f 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f"); background: -o-linear-gradient(top, #005fbf, 003 f7f); background-color: #005fbf; border: 0px solid #000000; text-align: center; border-width: 0px 0px 1px 1px; font-size: 14px; font-family: Arial; font-weight: bold; color: #ffffff; } .CSSTableGenerator tr:first-child:hover td { background: -o-linear-gradient(bottom, #005fbf 5%, #003f7f 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #005fbf), color-stop(1, #003f7f)); background: -moz-linear-gradient(center top, #005fbf 5%, #003f7f 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#005fbf", endColorstr="#003f7f"); background: -o-linear-gradient(top, #005fbf, 003 f7f); background-color: #005fbf; } .CSSTableGenerator tr:first-child td:first-child { border-width: 0px 0px 1px 0px; } .CSSTableGenerator tr:first-child td:last-child { border-width: 0px 0px 1px 1px; } </style> </head> <body> <form name="input" action="qqyinyue.php" method="get"> 音乐名/歌手名/专辑名: <input type="text" name="key" autofocus> <input type="submit" value="Submit"> </form> <hr/> <?php if (isset($_GET["sid"])) { if (is_numeric($_GET["sid"])) { $sid = $_GET["sid"]; if (strlen($sid) < 10) { echo '<b>歌曲ID: </b>' . $sid . '<br />'; $data = file_get_contents('http://s.plcloud.music.qq.com/fcgi-bin/fcg_list_songinfo.fcg?idlist=' . $sid . '&callback=jsonCallback&url=1'); $details = explode('|', $data); echo '<b>歌曲名称: </b>' . $details[1] . '<br />'; echo '<b>歌手名称: </b>' . $details[3] . '<br />'; echo '<b>专辑名词: </b>' . $details[5] . '<br /><br />'; $data = preg_replace('/(.)*http:\/\//', 'http://', $data); $data = preg_replace('/' . $sid . '.m4a(.)*$/', '', $data); $sid = intval($sid); $flac = $data . strval($sid + 70000000) . '.flac'; $ape = $data . strval($sid + 80000000) . '.ape'; $mp3sd = $data . strval($sid + 30000000) . '.mp3'; $mp3hd = $data . strval($sid) . '.mp3'; echo "<h2>注意,并不是所有歌曲都提供无损格式,FLAC和APE地址只是理论上的,如果无法下载就是没有.</h2>"; echo "<h2>注意,请使用基于Webkit核心的浏览器,例如 谷歌Chrome浏览器.</h2>"; echo '<a target="_blank" rel="noreferrer" href="' . $flac . '">FLAC 格式</a><br /><br />'; echo '<a target="_blank" rel="noreferrer" href="' . $ape . '">APE 格式</a><br /><br />'; echo '<a target="_blank" rel="noreferrer" href="' . $mp3sd . '">低质量(128Kbps) MP3 格式</a><br /><br />'; echo '<a target="_blank" rel="noreferrer" href="' . $mp3hd . '">高质量(320Kbps) MP3 格式</a><br /><br />'; } else { echo "sid 长度不合法<br /><br />"; } } else { echo "sid 内容不合法<br />"; } } elseif (isset($_GET["key"])) { $url = 'http://cgi.music.soso.com/fcgi-bin/fcg_search_xmldata.q?source=10&w=' . iconv('UTF-8', 'GB2312', $_GET['key']) . '&type=qry_song&out=json&p=1&perpage=15&notice=0&needNewCode=0&inCharset=GB2312&outCharset=GB2312&format=jsonp&platform=musicbox&jsonpCallback=searchJsonCallback'; $data = file_get_contents($url); $values = array_values(preg_grep('/(songname|singername|albumname|musicid):/', explode(',', $data))); $song = array(); $sid = array(); $singer = array(); $album = array(); if (count($values) % 4 === 0) { for ($i = 0; $i < count($values) - 4; $i += 4) { array_push($sid, substr($values[$i], 8)); array_push($song, substr($values[$i + 1], 9)); array_push($singer, substr($values[$i + 2], 11)); array_push($album, substr($values[$i + 3], 10)); } unset($values); ?> <div class="CSSTableGenerator"> <table> <tr> <td> 歌名 </td> <td> 歌手 </td> <td> 专辑 </td> <td> 下载链接 </td> </tr> <?php for ($i = 0; $i < count($sid); $i++) { ?> <tr> <td><?= iconv('GB2312', 'UTF-8', $song[$i]) ?></td> <td><?= iconv('GB2312', 'UTF-8', $singer[$i]) ?></td> <td><?= iconv('GB2312', 'UTF-8', $album[$i]) ?></td> <td><a href="./qqyinyue.php?sid=<?= $sid[$i] ?>" target='_blank'>点击打开下载页</a></td> </tr> <?PHP }?> </table> </div> <?php } } ?> </body> </html>

preferences:
58.08 ms | 402 KiB | 5 Q