Answer the question
In order to leave comments, you need to log in
Generate this from a torrent file?
Hello, help me solve the problem!
There is a php code:
require 'system/functions/functions.benc.php';
$dict = bdec_file('public/test.torrent', (1024 * 1024) );
$v = $dict['value']['info']['value']['name']['value'];
print_r($v);
require 'system/functions/functions.benc.php';
$dict = bdec_file('public/test.torrent', (1024 * 1024) );
print_r($dict);
Array ( [type] => dictionary [value] => Array ( [announce] => Array ( [type] => string [value] => http://alltor.me/bt/announce.php?uk=0zTRESOuis [strlen] => 49 [string] => 46:http://alltor.me/bt/announce.php?uk=0zTRESOuis ) [announce-list] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => http://alltor.me/bt/announce.php?uk=0zTRESOuis [strlen] => 49 [string] => 46:http://alltor.me/bt/announce.php?uk=0zTRESOuis ) ) [strlen] => 51 [string] => l46:http://alltor.me/bt/announce.php?uk=0zTRESOuise ) [1] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => http://alltor.me:2710/announce [strlen] => 33 [string] => 30:http://alltor.me:2710/announce ) ) [strlen] => 35 [string] => l30:http://alltor.me:2710/announcee ) [2] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => http://retracker.local/announce [strlen] => 34 [string] => 31:http://retracker.local/announce ) ) [strlen] => 36 [string] => l31:http://retracker.local/announcee ) ) [strlen] => 124 [string] => ll46:http://alltor.me/bt/announce.php?uk=0zTRESOuisel30:http://alltor.me:2710/announceel31:http://retracker.local/announceee ) [azureus_properties] => Array ( [type] => dictionary [value] => Array ( [dht_backup_enable] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) ) [strlen] => 25 [string] => d17:dht_backup_enablei0ee ) [comment] => Array ( [type] => string [value] => http://alltor.me/viewtopic.php?p=785241 [strlen] => 42 [string] => 39:http://alltor.me/viewtopic.php?p=785241 ) [created by] => Array ( [type] => string [value] => uTorrent/3130 [strlen] => 16 [string] => 13:uTorrent/3130 ) [creation date] => Array ( [type] => integer [value] => 1451070427 [strlen] => 12 [string] => i1451070427e ) [encoding] => Array ( [type] => string [value] => UTF-8 [strlen] => 7 [string] => 5:UTF-8 ) [info] => Array ( [type] => dictionary [value] => Array ( [file-duration] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => integer [value] => 9202 [strlen] => 6 [string] => i9202e ) [1] => Array ( [type] => integer [value] => 9135 [strlen] => 6 [string] => i9135e ) [2] => Array ( [type] => integer [value] => 8030 [strlen] => 6 [string] => i8030e ) [3] => Array ( [type] => integer [value] => 7849 [strlen] => 6 [string] => i7849e ) [4] => Array ( [type] => integer [value] => 7666 [strlen] => 6 [string] => i7666e ) [5] => Array ( [type] => integer [value] => 7374 [strlen] => 6 [string] => i7374e ) [6] => Array ( [type] => integer [value] => 7135 [strlen] => 6 [string] => i7135e ) ) [strlen] => 44 [string] => li9202ei9135ei8030ei7849ei7666ei7374ei7135ee ) [file-media] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) [1] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) [2] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) [3] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) [4] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) [5] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) [6] => Array ( [type] => integer [value] => 0 [strlen] => 3 [string] => i0e ) ) [strlen] => 23 [string] => li0ei0ei0ei0ei0ei0ei0ee ) [files] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1839396864 [strlen] => 12 [string] => i1839396864e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e02.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e02.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e02.avie ) ) [strlen] => 65 [string] => d6:lengthi1839396864e4:pathl32:Muhtesem Yuzyil.Kosem.s01e02.aviee ) [1] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1825562624 [strlen] => 12 [string] => i1825562624e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e01.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e01.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e01.avie ) ) [strlen] => 65 [string] => d6:lengthi1825562624e4:pathl32:Muhtesem Yuzyil.Kosem.s01e01.aviee ) [2] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1606918144 [strlen] => 12 [string] => i1606918144e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e03.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e03.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e03.avie ) ) [strlen] => 65 [string] => d6:lengthi1606918144e4:pathl32:Muhtesem Yuzyil.Kosem.s01e03.aviee ) [3] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1571627008 [strlen] => 12 [string] => i1571627008e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e06.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e06.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e06.avie ) ) [strlen] => 65 [string] => d6:lengthi1571627008e4:pathl32:Muhtesem Yuzyil.Kosem.s01e06.aviee ) [4] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1534844928 [strlen] => 12 [string] => i1534844928e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e05.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e05.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e05.avie ) ) [strlen] => 65 [string] => d6:lengthi1534844928e4:pathl32:Muhtesem Yuzyil.Kosem.s01e05.aviee ) [5] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1473341440 [strlen] => 12 [string] => i1473341440e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e07.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e07.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e07.avie ) ) [strlen] => 65 [string] => d6:lengthi1473341440e4:pathl32:Muhtesem Yuzyil.Kosem.s01e07.aviee ) [6] => Array ( [type] => dictionary [value] => Array ( [length] => Array ( [type] => integer [value] => 1427220480 [strlen] => 12 [string] => i1427220480e ) [path] => Array ( [type] => list [value] => Array ( [0] => Array ( [type] => string [value] => Muhtesem Yuzyil.Kosem.s01e04.avi [strlen] => 35 [string] => 32:Muhtesem Yuzyil.Kosem.s01e04.avi ) ) [strlen] => 37 [string] => l32:Muhtesem Yuzyil.Kosem.s01e04.avie ) ) [strlen] => 65 [string] => d6:lengthi1427220480e4:pathl32:Muhtesem Yuzyil.Kosem.s01e04.aviee ) ) [strlen] => 457 [string] => ld6:lengthi1839396864e4:pathl32:Muhtesem Yuzyil.Kosem.s01e02.avieed6:lengthi1825562624e4:pathl32:Muhtesem Yuzyil.Kosem.s01e01.avieed6:lengthi1606918144e4:pathl32:Muhtesem Yuzyil.Kosem.s01e03.avieed6:lengthi1571627008e4:pathl32:Muhtesem Yuzyil.Kosem.s01e06.avieed6:lengthi1534844928e4:pathl32:Muhtesem Yuzyil.Kosem.s01e05.avieed6:lengthi1473341440e4:pathl32:Muhtesem Yuzyil.Kosem.s01e07.avieed6:lengthi1427220480e4:pathl32:Muhtesem Yuzyil.Kosem.s01e04.avieee ) [name] => Array ( [type] => string [value] => Muhtesem.Yuzyil.Kosem.S01 [strlen] => 28 [string] => 25:Muhtesem.Yuzyil.Kosem.S01 ) [piece length] => Array ( [type] => integer [value] => 8388608 [strlen] => 9 [string] => i8388608e ) [pieces] => Array ( [type] => string [value] =>
Answer the question
In order to leave comments, you need to log in
The first thing that came to mind -
foreach($dict['path'] as $path){
if($path['type'] == 'list'){
foreach($path['value'] as $list){
if($path['type'] == 'string'){
// $path['value'] ваше значение имени файла
}
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question