PHP parse html and change links

sltt9ffm

New Member
I'm creating a proxy server with PHP, and i was wondering if it were possible to convert links (both relative and absolute) to absolute URLS and then change the links so that they go to a place on my website. Its hard to explain, but this is essentially what i want\[code\]<html><body> <a href='http://www.google.com'>This is a link</a><br><br> <a href='http://stackoverflow.com/index.php'>This is another</a><br> <form action='/act.php'> <input type='submit'> </form>\[/code\]Which i would get using \[code\]file_get_contents("http://www.thiswebsite.com")\[/code\]The intended output would be\[code\] <html><body> <a href='http://stackoverflow.com/questions/14562264/proxy.php?url=http://www.google.com'>This is a link</a><br><br> <a href='http://stackoverflow.com/questions/14562264/proxy.php?url=http://www.thiswebsite.com/index.php'>This is another</a><br> <form action='proxy.php?url=http://www.thiswebsite.com/act.php'> <input type='submit'> </form>\[/code\]Thanks
 
Back
Top