4

How to Fetch Content in A Div Class using PHP Simple HTML DOM Parser.
Here i want to fetch content from a div class like:

<div class="post" imposition="usermanual">Some Content </div>

So, what is the way to fetch content using this div class post? I have tried this code but dont works:

$es = $html->find('.post');
$es = $html->find('div.post'); // also try this
$es = $html->find('div[class="post"]'); // also try this

Any idea?

1 Answer 1

7

Under the Magic Attributes tab of How to access the HTML element's attributes, you'll find how to access an object's innertext property. There's also a plaintext property.

$es = $html->find('div[class="post"]', 0);
echo $es->innertext; // Some Content 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.