PHP: Convert url in html to fully-fledged url?
<p>I am able to scrape a page for URLs, but I want to know what is the easiest way to convert the various formats that these links can be in, into a fully fledged url. For example:</p>

<p>If I scrape: www.mysite.com/some/place/in/space.html</p>

<p>And I get the following urls:</p>

<pre><code>../img.jpg
img.jpg
../../bla.jpg
inc/bla.jpg
/
./
</code></pre>

<p>They should resolve to</p>

<pre><code>www.mysite.com/some/place/img.jpg
www.mysite.com/some/place/in/img.jpg
www.mysite.com/some/bla.jpg
www.mysite.com/some/place/in/inc/bla.jpg
www.mysite.com/some/place/in/
www.mysite.com/some/place/in/
</code></pre>

<p>Is there a function that does this for all cases or is it something I would have to code?</p>
