medariox / scrapeer

Essential PHP library that scrapes HTTP(S) and UDP trackers for torrent information.
93 stars 29 forks source link

Scrape method trims custom announcement path in URI #28

Open d47081 opened 1 year ago

d47081 commented 1 year ago

I'm getting following error for one of my trackers, that has announce/scrape listener placed in sub-folder like

http://somehost:80/directory/announce

$scraper->get_errors() 

Array
(
    [0] => Invalid scrape connection (somehost:80).
)

after enable file_get_contents get output

PHP Warning:  file_get_contents(http://somehost:80/scrape?info_hash=somehash): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

in other words, my original address was replaced to the domain root

http://somehost:80/announce

Other trackers, that stores theirs announce listeners in the root - works well, suppose that's get_passkey issue where parser confuses by regex at line

if ( ! is_null( $path ) && preg_match( '/[a-z0-9]{32}/i', $path, $matches ) ) {