relative path links
Posted: Thu Jan 31, 2008 5:59 pm
I'm fetching a page that has links with relative paths. When I run the following code, I get a link that looks like http://testurl.com/dir1/dir2/filename/. Instead the path should be http://testurl.com/dir2/filename. (I don't want to use urllinks off of the fetch of the $mainpath page, since I'm having problems extracing links that way.) How can I make the <fetch $mainpath $htmllink> statement work to give me the correct path?
<$mainpath="http://testurl.com/dir1/">
<fetch $mainpath>
<$htmlpage=$ret>
<!-- sample relative path href would be "dir2/filename/" -->
<rex row "<a\space=!</a>+</a>" $htmlpage>
<$htmllink=$ret>
<fetch $mainpath $htmllink>
<urllinks>
<loop max=1 $ret>
<$relativepathlink=$ret>
</loop>
</rex>
<$mainpath="http://testurl.com/dir1/">
<fetch $mainpath>
<$htmlpage=$ret>
<!-- sample relative path href would be "dir2/filename/" -->
<rex row "<a\space=!</a>+</a>" $htmlpage>
<$htmllink=$ret>
<fetch $mainpath $htmllink>
<urllinks>
<loop max=1 $ret>
<$relativepathlink=$ret>
</loop>
</rex>