简体   繁体   English

PHP 的磁力链接库

[英]Magnet links library for PHP

Does anyone here know of a magnet-URI -parser for PHP?这里有人知道 PHP 的磁 URI解析器吗? To validate it, or maybe to extract some information from it?验证它,或者从中提取一些信息?

If you only need the fields, here is a quick and dirty one liner:如果您只需要这些字段,这里有一个快速而肮脏的衬里:

$link = 'magnet:?xt=urn:btih:0eb69459a28b08400c5f05bad3e63235b9853021&dn=Splinter.Cell.Blacklist-RELOADED&tr=udp%3A%2F%2Ftracker.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337';

parse_str(str_replace('tr=','tr[]=',parse_url($link,PHP_URL_QUERY)),$query);

print_r($query);

Should yield:应该产生:

 Array
 (
    [xt] => urn:btih:0eb69459a28b08400c5f05bad3e63235b9853021
    [dn] => Splinter.Cell.Blacklist-RELOADED
    [tr] => Array
        (
            [0] => udp://tracker.com:80
            [1] => udp://tracker.publicbt.com:80
            [2] => udp://tracker.istole.it:6969
            [3] => udp://tracker.ccc.de:80
            [4] => udp://open.demonii.com:1337
        )
)

In case you're looking for something like this:如果您正在寻找这样的东西:

Magnet URI: magnet:?xt=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C (valid)

  Display Name .... (dn): 
  eXact Length .... (xl): 
  eXact Topic ..... (xt): urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C
  Acceptable Source (as): 
  eXact Source .... (xs): 
  Keyword Topic ... (kt): 
  Manifest Topic .. (mt): 
  address TRacker . (tr): 

take a look at the Demo .看看演示

Can't say if this matches your need, your question was sort of unspecific.不能说这是否符合您的需要,您的问题有点不具体。 So leave a comment.所以留下评论。

<?php
include_once "alfa.hash2mui.class.php";
$h2m=new Hash2mui();
echo $h2m->grab_mui("11A2AC68A11634E980F265CB1433C599D017A759");
?>

source https://github.com/alfredfrancis/Info-Hash-To-Magnet-URI/blob/master/example.php来源https://github.com/alfredfrancis/Info-Hash-To-Magnet-URI/blob/master/example.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM