Lets say i have an external html page and I want to append text inside of a specific tag from my php admin page such as putting miscellaneous text inside of this span tag.
For example:
<html>
<body>
<span class="text"></span>
</body>
</html>
How would I do that with PHP? I’m trying to make an admin page for this website, and I need to append text inside of certain tags. I don’t even know where to start with this, please point me in the right direction.
You can do this using PHP’s DOMDocument, like so:
So, given this HTML:
The resulting HTML would be:
(Neglecting the DOCTYPE declaration that DOMDocument adds if it is not present)