Dynamically modify web pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rowan.bradley
Forum Newbie
Posts: 3
Joined: Sun Jan 13, 2008 7:09 am

Dynamically modify web pages

Post by rowan.bradley »

I have a requirement for my web server to receive a page request from a browser (which will contain in some way the URL of a web page on an external web server), to go an fetch the web page from the external server, to make some small changes to it, and then to serve it to the original requesting browser.

Is this possible in PHP? Any hints on how to do this or sample code would be really helpful...

Thanks - Rowan
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Dynamically modify web pages

Post by califdon »

You're treading on some dangerous ground here. Do you have the authority to use and modify pages at this other server?
rowan.bradley
Forum Newbie
Posts: 3
Joined: Sun Jan 13, 2008 7:09 am

Re: Dynamically modify web pages

Post by rowan.bradley »

>Do you have the authority to use and modify pages at this other server

I'm just trying to change the presentation of the data. It's public domain data (i.e. it's all on the existing web site) and I'm not trying to mislead or deceive anyone. I realise there are all sorts of bad reasons for doing this, but mine is a _good_ reason!

Rowan
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Dynamically modify web pages

Post by Mark Baker »

"public domain data"
Just because the data is published on a web page, doesn't mean that you have a right to modify and republish it at all. The data is still owned (copyright) by the original publisher, and they may not want it republished by anybody else.
rowan.bradley
Forum Newbie
Posts: 3
Joined: Sun Jan 13, 2008 7:09 am

Re: Dynamically modify web pages

Post by rowan.bradley »

I'm not republishing it - I'm making it available to a small, closed user group.

Can we get back to the technology - is this posible, and how? The ethics of it is a different topic...

Rowan
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Dynamically modify web pages

Post by Mark Baker »

It's perfectly possible, and there's dozens of questions posted here asking how to retrieve data from other sites. The answer is either curl or file_get_contents if permitted
Post Reply