docs
[mirrors/Programs.git] / php / torrentbot.php
1 <pre>
2 <h1>Torrent Search Bot</h1>
3 <form action="?" method="GET">
4 <input type="text" name="q"><input type="submit" value="!SearchNow!">
5 </form>
6
7 <?php
8 set_time_limit(0);
9
10 if(!isset($_GET['q'])) die('</pre>');
11 $q = $_GET['q'];
12
13 $q = urlencode($q);
14 $q = "http://www.google.com/search?num=100&q=$q%20filetype%3Atorrent";
15 echo("<a href=\"$q\">$q</a>\n\n");
16
17 preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode(@file_get_contents($q)), $torrents);
18 //print_r($torrents);
19 $torrents = $torrents[0];
20 foreach($torrents as $torrent) if(eregi('\.torrent', $torrent)){
21 echo("<a href=\"$torrent\">$torrent</a>\n");
22 }
23 ?>
24 </pre>
This page took 0.321682 seconds and 4 git commands to generate.