磁力链接:
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中有效
抱歉,我是编码新手,对编码知识不多
对于 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';
}
但这只检查格式是否正常,除非您尝试一下,否则您不知道磁力链接是否有效。