我正在刮取值的網頁並將它們存儲在一個數組中,此刻我可以全部拉入td.Place值,因爲它具有類。簡單的HTML DOM解析器 - 刮沒有id或類的html內容
注:我使用簡單的HTML DOM解析器
我當前的代碼,工程:
<?php
include('simple_html_dom.php');
$html = file_get_html('http://www...');
// initialize empty array to store the data array from each row
$theData3 = array();
// initialize array to store the cell data from each row
$rowData3 = arra
foreach($row->find('td.Place') as $cell)
{
// push the cell's text to the array
$rowData3[] = $cell->innertext;
}
// push the row's data array to the 'big' array
$theData3[] = $rowData3;
}
print_r($theData3);
?>
有什麼問題?
我想在值 & 拉 - 「梯度 **前兩個TD類=內的」 3在類=奇格勒*。因爲兩個TD值沒有id或class,所以我覺得很難。
這是我目前刮
<tr class="PersonrRow odd">
<td></td>
<td class="place">T9</td>
<td>
<span class="rank"></span>16</td>
<td class="Grad">-7
</td>
<td>
100
</td>
<td>
-3
</td>
<td>
712
</td>
<td>
682
</td>
<td>
702
</td>
<td>
68
</td>
<td class="person large"></td>
<td style="">
277
</td>
</tr>
我很困惑這裏是你使用php來取消這個或jquery,因爲我看不到jquery在這個問題 –
道歉標記我正在使用php,我會從我的問題標籤中刪除jquery。謝謝 – Helena
我不明白這裏的問題,使其更清晰 – Gtopuria