I'm making a kind of a proxy. My php script downloads a webpage and then it shows the downloaded content. The output doesn't look like the original webpage because some url's needs to be corrected (css, links, images, etc). So i'm looking for a libary that gets all html elements with src
and href
attributes so that I can change the value. For example:
<link href="/images/favicon.ico">
needs to be changed to
<link href="http://example.com/images/favicon.ico">
What is the best way to do this?