I have two different torrent scrapping classes and I want to combine them, they are working fine separately but the only problem is, when I convert my string into an array, it does not work.
That's the codes I am using so far.
<?php
require 'scraper.php';
require 'tor-info.php';
$scraper = new Scrapeer\Scraper();
$torrent = new Torrent( './test.torrent' );
$hashix = $torrent->hash_info();
var_dump($torrent->scrape()); // shows trackers list like this array(21) { ["udp://tracker4.piratux.com:6969/announce"]=> bool(false) ["udp://tracker.trackerfix.com:80/announce"]=> bool(false) ["udp://tracker.pomf.se:80/announce"]=> bool(false) ["udp://torrent.gresille.org:80/announce"]=> bool(false) so on..
$trackers = array( "udp://tracker4.piratux.com:6969/announce", "udp://tracker.trackerfix.com:80/announce", "udp://tracker.pomf.se:80/announce" ); // now here we need that trackers list
$hash = array( $hashix );
$info = $scraper->scrape( $hash, $trackers );
//print_r( $info );
echo '<br><hr>';
foreach ($info as $key => $value) {
echo 'SEEDS :' .$value['seeders'].'<br />';
echo 'LEECHES :' .$value['leechers'].'<br />';
}
?>
In the first part I converted the array into String to get the readable result, and then in the second part I needed to convert that string back into single array to produce the result.
$trackers = array ("udp://tracker4.piratux.com:6969/announce","udp://tracker.trackerfix.com:80/announce")array ( 0 => '"udp://tracker4.piratux.com:6969/announce"', 1 => '"udp://tracker.trackerfix.com:80/announce"', 2 => '"udp://tracker.pomf.se:80/announce"' )$trackers = array($tracker); $hash = array($hashix); $info = $scraper->scrape( $hash, $trackers );