Note that there are some explanatory texts on larger screens.

plurals
  1. POGet metadata from torrent file using BDecode
    primarykey
    data
    text
    <p>I' am trying to get the name and size of the torrent. I' am using BDecode: <a href="http://www.phpclasses.org/package/3473-PHP-Parse-and-extract-metadata-from-BitTorrent-files.html" rel="nofollow">Parse and extract metadata from BitTorrent files</a> Class to get the information from the torrent file.</p> <p><strong>Var_dump Results</strong></p> <pre><code>array(1) { ["info"]=&gt; array(4) { ["files"]=&gt; array(2) { [0]=&gt; array(2) { ["length"]=&gt; int(735053240) ["path"]=&gt; array(1) { [0]=&gt; string(54) "BULLET RAJA [2013] -HDRiP XViD MP3 [D3Si MaNiACs].avi" } } [1]=&gt; array(2) { ["length"]=&gt; int(3226657) ["path"]=&gt; array(1) { [0]=&gt; string(10) "sample.mkv" } } } ["name"]=&gt; string(50) "BULLET RAJA [2013] -HDRiP XViD MP3 [D3Si MaNiACs]" ["piece length"]=&gt; int(1048576) ["pieces"]=&gt; string(14100) "xxxxxxxxxxxxxxx" </code></pre> <p><strong>What I have done so far</strong></p> <pre><code>&lt;?php require_once 'class.bdecode.php'; $torrent = new BDECODE('myfile.torrent'); $results = $torrent-&gt;result; print '&lt;pre&gt;'; var_dump($torrent-&gt;result); print '&lt;/pre&gt;'; echo '&lt;hr/&gt;'; foreach($results as $value){ echo $value['name']; } foreach($results as $length){ foreach($length as $value){ echo $value["length"]; } } ?&gt; </code></pre> <p>My problem, I was able to get the name of the torrent but was not able to get the file size of the torrent. I' am getting this error.</p> <pre><code>BULLET RAJA [2013] -HDRiP XViD MP3 [D3Si MaNiACs] Notice: Undefined index: length in D:xxxxxxxx\example.php on line 27 Warning: Illegal string offset 'length' in D:xxxxxx\example.php on line 27 B Warning: Illegal string offset 'length' in D:xxxxxx\example.php on line 27 � </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload