Monday, 15 April 2013

search - PHP: searching for a specific element somewhere in an HTML document -



search - PHP: searching for a specific element somewhere in an HTML document -

i have rather big html document trying extract info from. have gotten far figuring out need utilize domdocument object, , xpath. need homecoming contents of specific div. news has class tag associated it. bad news is buried in non-specific location in html document, within several layers of othere div's, , location may change. so, looking homecoming contents of div.

<div class='target'>return of stuff</div>

the trick seems in don't know particular location particular div in. need way 'search entire dom div class-name of target'. there may multiple coinsurance, not. however, 1 time the, array of element contents, can take there. , again, using php 5.4.

the xpath query need is:

$query = "//div[@class='target']";

which can utilize domxpath object invoking query method.

php search dom xpath

No comments:

Post a Comment