磁力链接:
magnet:?xt=urn:btih:8fe65e43464debe1bc0961e4656ea780368d4fba&dn=A+Goofy+Movie+%281995%29+720p+HDTVRip+x264+Eng+Subs+%5BDual+Audio%5D+%5BHindi+DD+2.0+-+English+DD+2.0%5D+Exclusive+By+-%3D%21Dr.STAR%21%3D-&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fzer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce
我的问题是如何检查此链接是否有效或在PHP中有效
很抱歉,我是编码新手,我对编码知识不多。
答案 0 :(得分:1)
对于PHP,可以这样做:
$str = 'magnet:?xt=urn:btih:74651f66e937698dc5ac1e0e252f44795070a7b5&dn=archlinux-2017.03.01-dual.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce';
if(preg_match('/magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}/', $str)){
echo 'valid';
}
但是这只检查格式是否有序,除非你试用,否则你不知道磁链是否有效。