I have been trying to create a script for months that will search through an existing web page and edit all of the <a> tags to change the href attribute to use the script again to translate the anchors again...
for instance, lets say the script is called linktrans.php and it is passed a variable ($page) that contains a url (http://www.fakesite.com). linktrans.php opens http://fakesite.com then takes all the anchors (for example <a href="http://www.fakesite.com/info">info</a>) and changes it to make the linked page open with linktrans.php (<a href="/linktrans.php?page=http://www.fakesite.com/info">info</a> with the url encoding.. of course...)
A similar thing can be seen at http://www.anonymizer.com/ and used on hotmail when it takes links you recieved in emails and turns them into links which open another browser with a frame window the top being their ad and the bottom being the site that the link originaly linked to.
I have tried so many different regex's using many different functions and I seem to be unable to do it...
Any help you could fgive, a premade script, a regex for it... what ever would be GREAT!
-Mark