經過一些更詳細,更廣泛的研究後,我找到了一個辦法。這是我如何實現的。
<?php
require_once("phpQuery.php");
$min = isset($_GET['min']) ? $_GET['min'] : 1;
$max = isset($_GET['max']) ? $_GET['max'] : 2;
$pages = [];
foreach(range($min, $max) as $page) {
array_push($pages, iconv("CP1251", "UTF-8", file_get_contents("http://www.fayloobmennik.net/files/list/" . $page . ".html")));
}
$html = file_get_html("http://www.fayloobmennik.net/files/list/");
$elem = $html->find('div[id=info] table > tbody', 0);
$test = $elem->find('tr a');
foreach ($test as $test2) {
$regex = '/<a href=\"([^\"]*)\">(.*)<\/a>/iU';
$test2 = preg_match($regex, $test2, $match);
print_r(iconv("CP1251", "UTF-8", $match[2]));
echo "<br/>";
}
?>
phpQuery.php類是simple_html_dom(我相信這就是它的名字?)。
乾杯。
在您的問題中包含源代碼 – Sievajet 2015-02-17 22:10:30
這是一個文件共享網站。 – 2015-02-17 22:12:50
[你如何在PHP中解析和處理HTML/XML?](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php ) – HamZa 2015-02-17 22:16:03