我想解析这段代码,这是html:
<div class="fila">
<div class="ver_categoria">
<a href="/cat/5/" >Series</a>
</div>
<div class="ver_file">
<strong><a href="/descargas/120849" title=" Crimen" class="menu_link">Crimen</a></strong>
</div>
<div class="ver_date">114 sems</div>
<div class="ver_uploader">T - D - G</div>
<div class="ver_size">334 MB</div>
<div class="ver_seeds"><strong>9</strong></div>
<div class="ver_peers"><strong>1</strong></div>
</div>
<?php $url= $torrent;
$html = file_get_contents($url);
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'iso-8859-1');
$doc = new DOMDocument();
$doc->loadHTML($html);
$xpath = new DOMXpath($doc);
$articles = $xpath->query('//*[@class="fila"]');
foreach($articles as $item) {
$cols = $item->getElementsByTagName("div");
$tipo = $cols->item(0)->nodeValue;
$direc = $cols->item(1)->nodeType === XML_ELEMENT_NODE ? $cols->item(1)->getElementsByTagName('a')->item(0)->getAttribute('href') : '';
$direcci = str_replace("/","",$direc);
$direccion= str_replace("descargar","id=",$direcci);
$enlace = $cols->item(1)->nodeValue;
$tiempo = $cols->item(2)->nodeValue;
$amo = $cols->item(3)->nodeValue;
$tamano = $cols->item(4)->nodeValue;
$seeds = $cols->item(5)->nodeValue;
$peers = $cols->item(6)->nodeValue;
echo ''.$tipo.' '.$direccion.' '.$enlace.' '.$tiempo.' '.$amo.' '.$tamano.' '.$seeds.' '.$peers.'</br>';
};
?>
代码rus完美,但任何想法都避免结果中的第一行?