Forum Moderators: coopster

Message Too Old, No Replies

making a absolute url from relative url with base taget or current url

not as easy as it sounds.

         

ikbenhet1

3:33 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



I though i had this figured out, but i have not.

-If there no base target=, or base target is not "_top¦_blank¦_parent¦_self¦_new" then i can use the current_url minus filename at the end, as $current_url + relative path.
I now (should) have the absolute path.

-If there is a base target i use that. (what if it points to another frame?)
to get the base target i use:
preg_match('/<base target="(.*)">/i', $content, $matches);
$basetarget=$matches[1];

I can post my own code, which does not work 100%, i would rater use 'clean' code. So the question is how can i achieve this with php?

I can post what code i have now if needed/asked but my code does not do the job correct.

jatar_k

3:36 pm on Jun 13, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What exactly is the job you are trying to do? I don't really understand where exactly the confusion is.

ikbenhet1

3:40 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



I parsed a webpage and retrieved all urls in it.

The urls in the webpage contains a few relative urls
I want to convert the relative urls in absolute urls.

I hope this is more understandable. sorry for the unclear post above.

ikbenhet1

10:08 pm on Jun 13, 2003 (gmt 0)

10+ Year Member




I found the answer, on this forum. (ouch)

Thanks andreasfriedrich for your exellent post in [webmasterworld.com...]