I'm having an html file, index.php
I want to take the content within a <div>
with the class main
of that file and replace it with another text. How can i achieve that?
Sample content in html:
<div class="main">
Replace this text with some code!
</div>
I want get the content within this div using php and replace it with another content. But I have no idea on how to do this.
Update: I'm aware of client side trick with javascript. I want to do this server side. And the file will be html and not php. so I think i have to open the html in php and do this, though i don't precisely how.
Can this be done with xpath or html dom parser or something? A google search gave me these terms but i have no clue what they actually are.