I haven't explained this very well.
I am trying to create a new file path from a full url and a relative path.
Starting URL http://www. domain.com/folder1/folder2/folder3/file1.html
The starting URL is the page I am spidering for links.
file1.html has a link on it to file2.html
and the path of the link could be relative or absolute, it could be expressed in a number of ways:
PATH 1 folderA/file2.html
PATH 2 folder2/folderA/file2.html
PATH 3 http://www. domain.com/folder1/folder2/folderA/file2.html
what I want to do is create a new full path from the PATH.
- Turn these addresses in to arrays - DONE
- remove domain name off LINK1 (I know if the PATH contains
- then reverse the arrays - DONE
- remove the file names (first item in each array)
- Then compare the each level (array item) until we get a match.
Starting URL array
$array1 = file1.html
$array1 = folder3
$array1 = folder2
$array1 = folder1
LINK 2 array
$array2 = file2.html
$array2 = folderA
LINK 3 array
$array3 = file2.html
$array3 = folderA
$array3 = folder2
How can I compare my array items
to create the new link