<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iBlog random &#187; torrent</title>
	<atom:link href="http://blog.zurka.us/tag/torrent/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zurka.us</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 28 May 2013 20:28:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>OiNK Admin Found Not Guilty, Walks Free</title>
		<link>http://blog.zurka.us/oink-admin-found-not-guilty-walks-free/</link>
		<comments>http://blog.zurka.us/oink-admin-found-not-guilty-walks-free/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 15:59:05 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[oink]]></category>
		<category><![CDATA[piracy]]></category>
		<category><![CDATA[torrent]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/oink-admin-found-not-guilty-walks-free/</guid>
		<description><![CDATA[Lawyers have presented their final arguments in the trial of Alan Ellis. The prosecution slammed the ex-OiNK admin, saying that the site was set up with dishonest and profiteering intentions right from the start. The defense tore into IFPI and countered by calling Ellis an innovator with talents to be nurtured. Today the jury returned [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Foink-admin-found-not-guilty-walks-free%2F&title=OiNK+Admin+Found+Not+Guilty%2C+Walks+Free&desc=Lawyers+have+presented+their+final+arguments+in+the+trial+of+Alan+Ellis.+The+prosecution+slammed+the+ex-OiNK+admin%2C+saying+that+the+site+was+set+up+with+dishonest+and+profiteering+intentions+right+from+the+start.+The+defense+tore+into+IFPI+and+countered+by+calling+Ellis+an+innovator+with+talents+to&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>Lawyers have presented their final arguments in the trial of Alan Ellis. The prosecution slammed the ex-OiNK admin, saying that the site was set up with dishonest and profiteering intentions right from the start. The defense tore into IFPI and countered by calling Ellis an innovator with talents to be nurtured. Today the jury returned a unanimous verdict of not guilty, and Ellis walked free.</p>
<p><a href="http://torrentfreak.com/oink-admin-found-not-guilty-walks-free-100115/">Read more</a></p>
<p>Congrats!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/oink-admin-found-not-guilty-walks-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get torrent data with PHP</title>
		<link>http://blog.zurka.us/get-torrent-data-with-php/</link>
		<comments>http://blog.zurka.us/get-torrent-data-with-php/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 00:12:02 +0000</pubDate>
		<dc:creator>nasal</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[torrent]]></category>

		<guid isPermaLink="false">http://blog.zurka.us/?p=587</guid>
		<description><![CDATA[To use this code you first need to include a file with the benc, bdec and hex2bin functions. You can get these functions from here: functions.phps. &#38;lt;?php include &#039;functions.php&#039;; $torrent_data = bdec(file_get_contents(&#039;yourfile.torrent&#039;)); To get the torrent data (like the announce url, the files etc) it is enough if we decode the content of the torrent. [&#8230;]]]></description>
				<content:encoded><![CDATA[<div style="padding-top:15px;padding-right:0px;padding-bottom:0px;padding-left:0px;;" class="linksalpha_widget">
											<iframe
												style="height:25px !important; border:0px solid gray !important; overflow:hidden !important; width:550px !important;" frameborder="0" scrolling="no" allowTransparency="true"
												src="http://www.linksalpha.com/social?blog=iBlog+random&link=http%3A%2F%2Fblog.zurka.us%2Fget-torrent-data-with-php%2F&title=Get+torrent+data+with+PHP&desc=To+use+this+code+you+first+need+to+include+a+file+with+the+benc%2C+bdec+and+hex2bin+functions.+You+can+get+these+functions+from+here%3A+functions.phps.+%26amp%3Blt%3B%3Fphp+include+%27functions.php%27%3B+%24torrent_data+%3D+bdec%28file_get_contents%28%27yourfile.torrent%27%29%29%3B+To+get+the+torrent+data+%28like+the+announce+url%2C+the+files&fc=333333&fs=arial&fblname=like&fblref=facebook&fbllang=en_US&fblshow=1&fbsbutton=1&fbsctr=1&fbslang=en&fbsendbutton=1&twbutton=1&twlang=en&twmention=&twrelated1=&twrelated2=&twctr=1&lnkdshow=noshow&lnkdctr=1&buzzbutton=1&buzzlang=en&buzzctr=1&diggbutton=1&diggctr=1&stblbutton=1&stblctr=1&g1button=1&g1ctr=1&g1lang=en-US">
											</iframe>
										</div><p>To use this code you first need to include a file with the benc, bdec and hex2bin functions. You can get these functions from here: <a href="http://blog.zurka.us/wp-content/uploads/2008/10/functions.phps" target="_blank">functions.phps</a>.</p>
<pre class="brush: php">
&amp;lt;?php

include &#039;functions.php&#039;;

$torrent_data = bdec(file_get_contents(&#039;yourfile.torrent&#039;));
</pre>
<p>To get the <strong>torrent data</strong> (like the announce url, the files etc) it is enough if we <strong>decode</strong> the content of the torrent.</p>
<p>On the other hand, if we want to <strong>read the number</strong> of seeds, leechs and downloads, we must <strong>encode</strong> the info part of the torrent, <strong>encrypt</strong> it with the <a href="http://php.net/sha1" target="_blank">sha1</a> function and convert the result to <strong>lowercase</strong>.</p>
<pre class="brush: php">
$info = strtolower(sha1(benc($torrent_data[&#039;info&#039;])));
$scrape = str_replace(&#039;announce&#039;, &#039;scrape&#039;, $torrent_data[&#039;announce&#039;]);
$sources = bdec(@file_get_contents($scrape . &#039;?info_hash=&#039; . urlencode(hex2bin($info))));
</pre>
<p><span id="more-587"></span></p>
<p>Since it&#8217;s the <strong>scrape</strong> telling us how many seeds, leechs and downloads the torrent has, we have to <strong>change the announce url to the scrape url</strong> and read those informations.</p>
<p>Now we have everything we need to display the information. Let&#8217;s see how our torrent is structured.</p>
<pre class="brush: php">
echo &#039;&amp;lt; pre&amp;gt;&#039;;
print_r($torrent_data);
echo &#039;&amp;lt; /pre&amp;gt;&#039;;
</pre>
<p>We get an <strong>array</strong> with informations like the announce url, the creation date, another array with the files and more. What we want to <strong>display is the file</strong> (or files) in the torrent and the number of people <strong>sharing</strong> the files.</p>
<p>Let&#8217;s display the files in the torrent. The torrent structure is different if has one file or more files in it, so we first have to count the number of files and then, if the number is bigger than 1, do a loop and display every one of them, else display only the name of that one file.</p>
<pre class="brush: php">
$c = count($torrent_data[&#039;info&#039;][&#039;files&#039;]);
echo &#039;&amp;lt; h2&amp;gt;Files&amp;lt; /h2&amp;gt;&#039;;

if ($c &amp;gt; 1) {
	for ($i = 0; $i &amp;lt; $c; $i++) {
		echo $torrent_data[&#039;info&#039;][&#039;files&#039;][$i][&#039;path&#039;][&#039;0&#039;] . &#039;&amp;lt;br/&amp;gt;&#039;;
	}
} else {
	echo $torrent_data[&#039;info&#039;][&#039;name&#039;] . &#039;&amp;lt;br/&amp;gt;&#039;;
}

</pre>
<p>Now we have our files listed. But to display the sources we find a little <strong>problem</strong>: the array in which the sources are stored is the binary version of our $info variable. We can reach them using the hex2bin function we have in our functions.php file.</p>
<pre class="brush: php">
$seeds = $sources[&#039;files&#039;][hex2bin($info)][&#039;complete&#039;];
$leechs = $sources[&#039;files&#039;][hex2bin($info)][&#039;incomplete&#039;];
$downloads = $sources[&#039;files&#039;][hex2bin($info)][&#039;downloaded&#039;];

echo &#039;&amp;lt; h2&amp;gt;Sources&amp;lt; /h2&amp;gt;&#039; .
	&#039;&amp;lt;b&amp;gt;Seeds:&amp;lt;/b&amp;gt; &#039; . $seeds . &#039;&amp;lt;br/&amp;gt;&#039; .
	&#039;&amp;lt;b&amp;gt;Leechs:&amp;lt;/b&amp;gt; &#039; . $leechs . &#039;&amp;lt;br/&amp;gt;&#039; .
	&#039;&amp;lt;b&amp;gt;Downloads:&amp;lt;/b&amp;gt; &#039; . $downloads . &#039;&amp;lt;br/&amp;gt;&#039;;

?&amp;gt;
</pre>
<p>I prepared a test file <a href="http://blog.zurka.us/wp-content/uploads/2008/10/torrent.php" target="_blank">torrent.php</a>. The torrent it is checking is a <a href="http://thepiratebay.org/torrent/4402888/T.I.-Paper.Trail.(Explicit.Retail-2008)-%5BNoFS%5D" target="_blank">music torrent</a> from thepiratebay.org.</p>
<p>You can download the source of this test file here: <a href="http://blog.zurka.us/wp-content/uploads/2008/10/torrent.phps" target="_blank">torrent.phps</a>.</p>
<p>Same as always, if you don&#8217;t understand something you can ask it in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zurka.us/get-torrent-data-with-php/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
	</channel>
</rss>
