我正在使用 Simple HTML Dom,它在我的大部分数据上都运行良好。但是,由于标记无效,因此很痛苦。有没有其他方法可以在 PHP 中做到这一点。
我从试图从中提取价格的页面中得到了这个结果:
<taconite><replacecontent select="#basketcontents"><![CDATA[
<table id="sellingb" cellpadding="10px" cellspacing="15" width="600" border="0">
<thead>
<tr class="title">
<th width="47" scope="col" align="center">Book</th>
<th width="213" scope="col" align="left">Title</th>
<th width="139" scope="col" align="left">ISBN/Barcode</th>
<th width="63" scope="col" align="left">Value</th>
<th width="29" scope="col"> </th>
</tr>
</thead>
<tbody>
<tr class="trrow">
<td class="tdbook" align="center" valign="middle" ><img src="http://ecx.images-amazon.com/images/I/61JEp-wF3zL._SL75_.jpg" /><input name="offers_row_img[0]" type="hidden" value="http://ecx.images-amazon.com/images/I/61JEp-wF3zL._SL75_.jpg" /></td>
<td class="tdtitle">The Last Of Us (PS3) [Video Games]<input name="offers_row_title[0]" type="hidden" value="The Last Of Us (PS3) [Video Games]" /></td>
<td class="tdisbn">0711719274551<input name="offers_row_isbn[0]" type="hidden" value="0711719274551" /></td>
<td class="tdval">£15.00<input name="offers_row_price[0]" type="hidden" value="15.00" /></td>
<td class="tdremove"><input type="button" onclick="removeitem(0);" value="Reject Offer" /></td>
</tr>
</tbody>
</table>]]></replacecontent><eval><![CDATA[jQuery('#isbn').val('');]]></eval><replacecontent select="#price"><![CDATA[£15.00<br /><input type="button" class="bask-sb" id="acceptoffer" onclick="confirm('By clicking OK you are accepting the offer of £15.00 for your 1 item(s).'); acceptoffer();"/>]]></replacecontent></taconite>
不过,好像有问题。简单 HTML Dom 仅适用于有效标记,这是无效的。我可以从这个结果中提取 15.00 英镑的最佳方法是什么。
谢谢。非常感谢。