i have been working on one tool lately. It grabs all the link addresses from the website.
My problem is that links in html code sometimes is different:
- /index.php
- index.php
- http://www.website.com/index.php
I need to make all links same:
/index.php -> http://www.website.com/index.php
index.php -> http://www.website.com/index.php
http://www.website.com/index.php -> http://www.website.com/index.php
Thanks for help.
Using preg_replace to fix relative urls
Requires:
$domain= the subject sites domain$path= the document or string you are looking for relative links with in.Returns:
$url= the doument or string with the links within it converted to proper urls with the domain given.Code:
good luck, let me know how it goes.