php - Change content of distant web page -


i'm trying make little fun page saw on internet years ago. want take content of distant web page, change words (for example, replace random words "blablabla") , show on server (of course it's impossible change content on distant server). must have same css etc, if iframe, words replaced.

i succeeded in grabbing distant content (with curl) , show domdocument

$url = "http://www.example.fr"; $curl = curl_init($url); curl_setopt($curl, curlopt_returntransfer, true); $output = curl_exec($curl); curl_close($curl);   $dom = new domdocument; $dom->loadhtml($output);  echo $dom->savehtml(); 

but want edit viewable text on page (titles, content, etc) change random words. can make on particular website changing id's content :

$dom->getelementsbytagname('h1'); 

but not every websites have h1 or h2 etc. want change text displayed no matter id is. don't know if domdocument has function this. thank !


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -