开发者

Get data from specific HTML table cells using Php

I need to get the data out of all of the table cells in the 4th row of the 4th table on an HTML page. After researching for a while, it seems that using DOMXPath is the best way to parse the HTML file. However, no IDs or classes are used anywhere in the file. W开发者_如何学JAVAhat would be the best way to get the data out of these cells?

Thanks in advance.


You can specify an index when fetching with XPath. In your case

/html/body/table[4]/tbody/tr[4]/td

Note that an XPath index is not zero-based, but one-based.


If you are familiar with jQuery syntax, have you looked into phpQuery?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜