By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,751 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,751 IT Pros & Developers. It's quick & easy.

Get absolute URL of relative link?

P: n/a
Given a page's URL, and a URL in a link found inside it, how can I
resolve this link-URL to become an absolute URL?

function getAbsoluteUrl($baseurl, $relativeurl);

Examples:

Page: http://www.example.com/index.html
Link: /about.html
Result: http://www.example.com/about.html

Page: http://www.example.com/lang/german/
Link: ../lang/en/
Result: http://www.example.com/lang/en/

etc.

Anybody know how to write this function?
(I'm playing around with a spider.)

--
Google Blogoscoped
http://blog.outer-court.com
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.