ok what am trying to do is create a conveter that takes out all tags from a website and only display text and the links.
My problem however is finding a way to add a string to an already existing url while the converter is translating
example 1:
unmodified url = <a href=
to
modified url = <a href=example.php?url=http://www.google.com</a>
when using clicks the link the browser will go to google
now i've figured out how to do example 1 by using str_replace however i can't use the str_replace method when the url isn't absolute
example 2
<a href=whatever.php>what</a> to <a href=example.php?url=whatever.html>what</a>
when user clicks browser will not go anywhere...
now i am asking if anyone can help me find a way to add the full path with relative link so that when a user clicks on the link the browser will go to it's intended destination..
i've tried the <base href= method but it doesn't work as attended
thank you for any replies and apologies for this long message
My problem however is finding a way to add a string to an already existing url while the converter is translating
example 1:
unmodified url = <a href=
to
modified url = <a href=example.php?url=http://www.google.com</a>
when using clicks the link the browser will go to google
now i've figured out how to do example 1 by using str_replace however i can't use the str_replace method when the url isn't absolute
example 2
<a href=whatever.php>what</a> to <a href=example.php?url=whatever.html>what</a>
when user clicks browser will not go anywhere...
now i am asking if anyone can help me find a way to add the full path with relative link so that when a user clicks on the link the browser will go to it's intended destination..
i've tried the <base href= method but it doesn't work as attended
thank you for any replies and apologies for this long message