function search_torrents($category = false, $search_text = false, $page = 0) { $sxe = get_sxe(TPB . '/browse/' . $category . '/' . $page . '/7/0/'); $trs = $sxe->xpath('//*[@id="searchResult"]/tr'); $torrents = array(); for ($i = 0; $i < count($trs) - 1; $i++) { $tr = $trs[$i]; $torrent = array(); $torrent['name'] = (string) $tr->td[1]->div->a; $torrent['id'] = preg_replace("/\\/torrent\\/(\\d+)\\/.*/", "\$1", $tr->td[1]->div->a['href']); $torrent['magnet_link'] = (string) $tr->td[1]->a[0]['href']; $torrent['seeds'] = (string) $tr->td[2]; $torrent['leeches'] = (string) $tr->td[3]; $torrents[] = $torrent; } return $torrents; }
<?php require_once __DIR__ . '/config.php'; $category = $_REQUEST['cat']; $sxe = get_sxe(TPB . '/browse/' . $category . '/0/7/0/'); // echo $sxe->asXML(); //var_dump($sxe); //echo file_get_contents(TPB . '/browse/' . $category); $trs = $sxe->xpath('//*[@id="searchResult"]/tr'); for ($i = 0; $i < count($trs) - 1; $i++) { $tr = $trs[$i]; $name = (string) $tr->td[1]->div->a; $detail_link = $tr->td[1]->div->a['href']; $magnet_link = $tr->td[1]->a[0]['href']; echo $name . '<br>'; echo $detail_link . '<br>'; echo $magnet_link; echo '<br><br>'; }