I’m parsing HTML files and parsing out the links. Sometimes it comes accross
something like:
./dir/dir/lol.html
My question is how do I turn this into an absolute url, the parser knows the URL that if found the link on.
For example:
parses: http://www.website.com/lol/index.html
find: ./dir/dir/haha.html
Then how can I combine this into:
http://www.website.com/lol/dir/dir/haha.html
You could use parse_url() to break URLs into their components most importantly
PHP_URL_PATHto find out the path part of the URL.