I am trying to get the plaintext from the given html. But, it is not possible for me. for this, what I had done is
My html is in $content
variable
Now, I am passing $content variable to php DomDocuemnt
$d = new DOMDocument();
@$d->loadHTML($content)
Whats my next step to get the plaintext from the obtained html.
Please help me in this. Thanks in advance!
I can't understand your question but if you want the HTML code as string then Try this...
$d = new DOMDocument();
$d->loadHTML($content);
$plainText = $d->textContent;
echo $plainText;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With