BottledTurtles BottledTurtles - 1 year ago 123
PHP Question

How to get html codes between two tags

Here's HTML Codes:

<div class="body" style="text-align: justify;padding: 10px;">

I want to get innerHTML of a div tag which has

Answer Source

Use XPath selector for tasks similar to this.

$dom = new DomDocument();
$finder = new DomXPath($dom);
$nodes = $finder->query("//*[contains(@class, '$classname')]");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download