Hi i try scrape udp tracker, but not work showing "Time Out"
//===| Scrape External Torrents
if ($row["external"]=='yes')
{
print ("<td width='160' align='right' valign='top'><table><tr>");
if ($scrape =='1')
{
print("<td class='f-border p-title' width='150' valign='middle'>
<div style='margin-top:5px; margin-bottom:10px; font:bold 16px Times' align='center'><font color='#FF2000'>".T_("EXTERNAL_TORRENT")."</font></div>");
//===| Scrape HTTP
$seeders1 = $leechers1 = $downloaded1 = null;
$tres = SQL_Query_exec("SELECT url FROM announce WHERE torrent=$id");
while ($trow = mysqli_fetch_assoc($tres))
{
$ann = $trow["url"];
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = preg_replace("/^announce/", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;
if ($oldpath == $path) { continue; }
if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker)) { $tracker = "http://tracker.openbittorrent.com/scrape"; }
$stats = torrent_scrape_url($tracker, $row["info_hash"]);
if (isset($stats['seeds']) != -1)
{
$seeders1 += (isset($stats['seeds']));
$leechers1 += (isset($stats['peers']));
$downloaded1 += (isset($stats['downloaded']));
}
}
//===| End Scrape HTTP
//===| Scrape UDP
$resu = SQL_Query_exec("SELECT id, info_hash FROM torrents WHERE external = 'yes' AND id = $id");
while ($rowu = mysqli_fetch_array($resu))
{
$TorrentInfo = ParseTorrent("$site_config[torrent_dir]/$rowu[id].torrent");
$ann = $TorrentInfo[0];
$annlist = array();
if ($TorrentInfo[6])
{
foreach ($TorrentInfo[6] as $ann)
{
$annlist[] = $ann[0];
}
}
else
$annlist = array($ann);
$seeders = $leechers = $downloaded = null;
foreach ($annlist as $ann)
{
$tracker = explode("/", $ann);
$path = array_pop($tracker);
$oldpath = $path;
$path = str_replace("announce", "scrape", $path);
$tracker = implode("/", $tracker)."/".$path;
if ($oldpath == $path)
{
continue;
}
if ($openbittorrent_done)
continue;
if (preg_match("/thepiratebay.org/i", $tracker) || preg_match("/prq.to/", $tracker))
{
$tracker = "http://tracker.openbittorrent.com/scrape";
$openbittorrent_done = 1;
}
if(preg_match('%udp://([^:/]*)(?::([0-9]*))?(?:/)?%si', $tracker))
{
$udp=true;
try
{
$timeout = 5;
$udp= new udptscraper($timeout);
$stats=$udp->scrape($tracker,$rowu["info_hash"]);
foreach ($stats as $idu=>$scrape)
{
$seeders += $scrape['seeders'];
$leechers += $scrape['leechers'];
$downloaded += $scrape['completed'];
}
}
catch(ScraperException $e)
{
$e->isConnectionError();
}
}
else
{
$stats = torrent_scrape_url($tracker, $rowu["info_hash"]);
}
if (isset($stats['seeds']) != -1)
{
$seeders += (isset($stats['seeds']));
$leechers += (isset($stats['peers']));
$downloaded += (isset($stats['downloaded']));
$totseed = $seeders1 + $seeders;
$totleech = $leechers1 + $leechers;
$totcomp = $downloaded1 + $downloaded;
SQL_Query_exec("UPDATE `announce` SET `online` = 'yes', `seeders` = $totseed, `leechers` = $totleech, `times_completed` = $totcomp WHERE `url` = ".sqlesc($ann)." AND `torrent` = $rowu[id]");
}
else
{
SQL_Query_exec("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $rowu[id]");
}
}
if ($seeders !== null)
{
SQL_Query_exec("UPDATE torrents SET leechers = '".$totleech."', seeders = '".$totseed."', times_completed = '".$totcomp."', last_action = '".get_date_time()."', visible = 'yes' WHERE id = '".$rowu['id']."'");
}
else
{
SQL_Query_exec("UPDATE torrents SET leechers = '0', seeders = '0', last_action = '".get_date_time()."' WHERE id='".$rowu['id']."'");
}
}
//===| End Scrape UDP
if ($seeders !== null) {
print ("<div style='margin-bottom:5px; margin-left:20px'><b>".T_("LIVE_STATS")."</b>: </div>");
print ("<div style='margin-left:20px'>".T_("SEEDERS").": <font color='#24AA24'>".$totseed."</font></div>");
print ("<div style='margin-left:20px'>".T_("LEECHERS").": <font color='#D70000'>".$totleech."</font></div>");
print ("<div style='margin-left:20px'>".T_("COMPLETED").": <font color='#0080FF'>".$totcomp."</font></div>");
} else {
print ("<div style='margin-top:10px; margin-bottom:5px' align='center'><b>".T_("LIVE_STATS")."</b>: </div>");
print ("<div style='font:italic 14px Times' align='center'><font color='#D70000'>".T_("TRACKERS_OFFLINE")."!</font></div>");
}
print ("<div style='margin-top:10px; margin-bottom:10px' align='center'>
<a href=\"torrents-details.php?id=".$id."\"><input type=\"submit\" name=\"submit\" value=\"".T_("SUBMIT")."\"></a>
</div>");
print ("</td>");
}
else
{
if (get_user_class() >= 5){
print ("<td class='f-border p-title' width='150' valign='middle' align='center'>
<div style='margin-top:5px; margin-bottom:10px; font:bold 16px Times' align='center'><font color='#D70000'>".T_("EXTERNAL_TORRENT")."</font></div>
<div style='margin-bottom:5px; font:normal 12px Times' align='center'>".T_("UPDATE_STATS")."</div></div>
<div style='margin-top:5px; margin-bottom:10px' align='center'>
<img src='images/load.gif' border='0' width='32' height='32'><br />
<form action='torrents-details.php?id=$id&scrape=1' method='post'><input type=\"submit\" name=\"submit\" value=\"".T_("UPDATE")."\" /></form>
</div>
</td>");
}
}
print ("</tr></table></td>");
}
//===| End Scrape External Torrents
udp://tracker.openbittorrent.com:6969/announce
udp://9.rarbg.to:2710/announce
udp://9.rarbg.me:2780/announce
udp://9.rarbg.to:2730/announce
udp://tracker.opentrackr.org:1337
http://p4p.arenabg.com:1337/announce
udp://tracker.torrent.eu.org:451/announce
udp://tracker.tiny-vps.com:6969/announce
udp://open.stealth.si:80/announce
<?
class ScraperException extends Exception
{
private $connectionerror;
public function __construct($message, $code = 0, $connectionerror = false)
{
$this->connectionerror = $connectionerror;
parent::__construct($message, $code);
}
public function isConnectionError()
{
return ($this->connectionerror);
}
}
abstract class tscraper
{
protected $timeout;
public function __construct($timeout = 2)
{
$this->timeout = $timeout;
}
}
class udptscraper extends tscraper
{
.........
Array ( [fe91262c62f9877f0d79c6cf87b0fb904ae80e80] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => fe91262c62f9877f0d79c6cf87b0fb904ae80e80 ) )
$timeout = 2;
$scraper = new ScrapeTorrent($timeout);
$urls = array(
'udp://tracker.opentrackr.org:1337/announce',
'udp://tracker.pomf.se:80/announce',
'udp://tracker.sylphix.com:6969/announce',
'udp://tracker.theoks.net:6969/announce',
'udp://tracker.torrent.eu.org:451/announce',
'udp://tracker1.bt.moack.co.kr:80/announce',
'udp://tracker2.dler.com:80/announce',
'udp://tracker6.lelux.fi:6969/announce'
);
foreach ($urls as $url) {
try {
$ret = $scraper->scrape($url, 'd158701550334ff31273e1f3788bdb3c1f10a3ed');
print_r($ret);
} catch (ScraperException $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
if ($e->isConnectionError()) {
echo 'Connection error: ' . $e->getCode() . PHP_EOL;
}
}
}
Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) No connection response.Connection error: 1No connection response.Connection error: 1Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Array ( [d158701550334ff31273e1f3788bdb3c1f10a3ed] => Array ( [seeders] => 0 [completed] => 0 [leechers] => 0 [infohash] => d158701550334ff31273e1f3788bdb3c1f10a3ed ) ) Could not open UDP connection: 0 - php_network_getaddresses: getaddrinfo for tracker6.lelux.fi failed: Name does not resolveConnection error: 1
No users online
Torrents
Members
Online