Looking for php libary that correct url`s of a html page
<p>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 <code>src</code> and <code>href</code> attributes so that I can change the value. For example:</p>

<pre><code>&lt;link href="/images/favicon.ico"&gt;
</code></pre>

<p>needs to be changed to</p>

<pre><code>&lt;link href="http://example.com/images/favicon.ico"&gt;
</code></pre>

<p>What is the best way to do this?</p>
