curl_settings); array_push($chs, $ch); curl_multi_add_handle($mh, $ch); } $running = null; do { curl_multi_exec($mh, $running); } while ($running); for ($i=0; count($chs)>$i; $i++) { $response = curl_multi_getcontent($chs[$i]); switch ($i) { case 0: $results = array_merge($results, get_thepiratebay_results($response)); break; case 1: $results = array_merge($results, get_rutor_results($response)); break; case 2: $results = array_merge($results, get_nyaa_results($response)); break; case 3: $results = array_merge($results, get_yts_results($response)); break; case 4: $results = array_merge($results, get_torrentgalaxy_results($response)); break; case 5: $results = array_merge($results, get_1337x_results($response)); break; case 6: $results = array_merge($results, get_sukebei_results($response)); break; } } $seeders = array_column($results, "seeders"); array_multisort($seeders, SORT_DESC, $results); return $results; } function print_merged_torrent_results($results) { echo "
"; if (!empty($results)) { foreach($results as $result) { $source = $result["source"]; $name = $result["name"]; $magnet = $result["magnet"]; $seeders = $result["seeders"]; $leechers = $result["leechers"]; $size = $result["size"]; echo "
"; echo ""; echo "$source"; echo "

$name

"; echo "
"; echo "SE: $seeders - "; echo "LE: $leechers - "; echo "$size"; echo "
"; } } else echo "

There are no results. Please try different keywords!

"; echo "
"; } ?>