Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug fixes

  • Loading branch information...
commit 1c893b5651946cf3e3be260cbbb92e59e6d3a8d7 1 parent 97e5e99
@johannes85 johannes85 authored
Showing with 4 additions and 6 deletions.
  1. +1 −2  httptscraper.php
  2. +3 −4 udptscraper.php
View
3  httptscraper.php
@@ -62,9 +62,8 @@ public function scrape($url,$infohash){
}
ini_set('default_socket_timeout',$this->timeout);
- echo($requesturl . "\n");
$rh = @fopen($requesturl,'r');
- if(!$rh){ throw new ScraperException('Could not open HTTP connection.'); }
+ if(!$rh){ throw new ScraperException('Could not open HTTP connection.',0,true); }
stream_set_timeout($rh, $this->timeout);
$return = '';
View
7 udptscraper.php
@@ -1,6 +1,6 @@
<?php
/* Torrent UDP Scraper
- v1.1
+ v1.2
2010 by Johannes Zinnau
johannes@johnimedia.de
@@ -39,12 +39,11 @@ public function scrape($url,$infohash){
}
if(count($infohash) > 74){ throw new ScraperException('Too many infohashes provided.'); }
if(!preg_match('%udp://([^:/]*)(?::([0-9]*))?(?:/)?%si', $url, $m)){ throw new ScraperException('Invalid tracker url.'); }
- $tracker = $m[1];
+ $tracker = 'udp://' . $m[1];
$port = isset($m[2]) ? $m[2] : 80;
$transaction_id = mt_rand(0,65535);
-
- $fp = fsockopen('udp://tracker.openbittorrent.com', 80, $errno, $errstr);
+ $fp = fsockopen($tracker, $port, $errno, $errstr);
if(!$fp){ throw new ScraperException('Could not open UDP connection: ' . $errno . ' - ' . $errstr,0,true); }
stream_set_timeout($fp, $this->timeout);
Please sign in to comment.
Something went wrong with that request. Please try again.