現在發現查詢是否'$ NotXP-> query'=查詢返回字符串?!如何在php DOMXPath對象中返回?
如何使下一個代碼工作?
$xp = new \DOMXPath(@\DOMDocument::loadHTMLFile($url));
$list = $xp->query('//table[@class="table-list quality series"] tbody');
$link = $list->query('//tr[@class="item"]');
$arr_links = [];
foreach ($link as $link_in_cycle) {
$link_quality = $link_in_cycle->query('//td[@class="column first video"]');
$link_audio = $link_in_cycle->query('//td[@class="column audio"]');
$link_size = $link_in_cycle->query('//td[@class="column size"]');
$link_seed = $link_in_cycle->query('//td[@class="column seed-leech"] span[@class="seed"]');
$link_download_url = $link_in_cycle->query('//td[@class="column last download"] a')->getAttribute("data-default");
的要求@佰仁
從這個代碼HTML源需要信息的抓取
<tbody>
<tr class="item">
<td class="column first video">720x400</td>
<td class="column audio">mp3</td>
<td class="column size">5.70 Gb</td>
<td class="column seed-leech">
<span class="seed">15</span>
<span class="leech">26</span>
</td>
<td class="column updated">07.07.2017</td>
<td class="column consistence"><a href="javascript:void(0);" title="title in td" data-type="torrent-consistence" class="show-modal show-consistence" data-route="/hashinfo/12345?fields=files"></a></td>
<td class="column last download">
<a class="button middle rounded download zona-link"
data-type="download"
data-zona="0"
data-torrent=""
data-default="url_data"
data-not-installed=""
data-installed=""
data-metriks="{'eventType': 'click', 'data' : { 'type': 'show_download', 'id': '84358'}}"
title="text in title" href="javascript:void(0);" >Download</a> </td>
你能告訴你想什麼來實現的,可能是樣本網址,人們可以使用測試任何可能的解決方案。 –
@NigelRen,添加html源代碼 – ALPHA