Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Adding a base URL to links - please help
- Kevin Morgan
May 15, 2005, 11:10 pm
rate this thread
I'm new to the world of PHP, so forgive me if this is a daft question.
I've written a script which pulls some headlines from a remote site and
displays them on my server. Trouble is, all of the links are relative
and I need some way of adding the "http://www.foobar.com /" to the start
of these links.
How do I go about doing it?
Re: Adding a base URL to links - please help
Look into regular expressions. Search for the <a href=""> tag and check
the contents inside. Then do a replace on the link it self.
I would write it out for you but that doesn't help you to learn it yourself.
A good starting point for regular expressions is: http://www.regexplib.com