PDA

View Full Version : Is this possible?



Wojtek
August 10th, 2002, 21:27
I'd like to do somehting like this:

a CGI or PHP script that fetches a page lets say www.host.com/page.html takes the html source, takes all the a href's (ex: www.host.com/page2.html) and changes it to www.myhost.com/myphp.php?www.host.com/page2.html so the page2 is reloaded into the script again so it takes all hrefs from page2 and son on.

I'd need this so I can put a top header/footer for each page, but to make it look like the page is hosted on my site. and if the user clicks a link inside the page, it would reload with the page he requested along with the header and footer.

Thanks Alot

Daniel
August 10th, 2002, 21:58
Use a program such as Dreamweaver, Edit Plus, etc. and use Find and Replace.

Wojtek
August 10th, 2002, 23:46
no,no,no

a page from another host.
Not a page from my site.


check the exemple.
I used host.com and myhost.com

spork
August 11th, 2002, 06:22
its possible, i can tell you that much...

Wojtek
August 11th, 2002, 11:49
And could you provide me with some informations on how to do it?
I know how to get the source from a page, but don't know howto replace a link with my link.

So basically, all I need it a function that would look thruh $source and replace all instances of "http://www.host.com/" with "http://www.myhost.com/myphp.php?www.host.com/"

Anyone knows how?

spork
August 11th, 2002, 15:22
http://www.php.net/manual/en/function.ereg-replace.php

Wojtek
August 11th, 2002, 18:49
Thanks alot

I'll try it when I get back on my laptop.