php - combining getElementsByTagName and getElementsByClassName DOMDocument


i try to combininggetElementsByTagName andgetElementsByClassName but i got some error.

for example<p class="castplot">some text here.</p>

i want to getsome text here.

here what i try.

$information = html_entity_decode ($value['information']);

    $dom = new DOMDocument();

    $p1 = $dom->getElementsByTagName('p')->getElementsByClassName('castplot')->textContent;

error i get

Uncaught Error: Call to undefined method DOMNodeList::getElementsByClassName() in C:\xampp\htdocs\piratefiles\fetch_details.php:21 Stack trace:

0 {main} thrown in

People are also looking for solutions to the problem: php - Symfony Component HttpKernel Exception MethodNotAllowedHttpException. What is the cause?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.