Jump to content

Duplicate another page - problem


bonnag

Recommended Posts

Hi,

 

I'm new to php and I'm stuck.

 

I'm trying to duplicate another page using php, but I have a problem with relative and absolute paths.

 

I've tried include() and I've tried file_get_contents() but I can't figure out how to handle the relative references.

As a practice I've just been using the google homepage and the best that I can get can be seen here http://www.drzo.com/cb/1.php

 

It is begining to drive me insane.

 

Thanks in advance,

 

Scott

Link to comment
https://forums.phpfreaks.com/topic/114905-duplicate-another-page-problem/
Share on other sites

Probably for fun or to allow for some sort "browsing remote sites from a frame" I guess :)

 

well fun=stealing most likely.. yea its fun to play with the code and see what you can do but why duplicate a page??

 

also if you were to be browsing remote sites in a frame why would you need to use php?

 

all i'm saying is I build stuff on the web.. and I don't want some guy coming over and using php to scoop up what I made ya know.

Hi,

 

I can understand your reservations regarding 'stealing'.

I have the premission of a website owner to duplicate some of their pages and they are likely to change.

I want to have a way to do have it work dynamically rather than having to pull all the pages over or cron a backup etc.

 

As for the code that I have it is virtually non-existant.

 

<?php

$file = file_get_contents ("http://www.google.com");

echo $file;

?>

 

Thats about as far as I got!

 

Regards,

 

Scott

When you are doing this the way you are, you could parse through the code you get and change the URLs...

 

For example the google page use css to insert pictures:

 

<div align=left style="background:url(/intl/en_com/images/logo_plain.png) no-repeat;height:110px;width:276px" title="Google">

 

 

So you have to change /intl/en_com/images/logo_plain.png into http://www.google.com/intl/en_com/images/logo_plain.png

 

Use regex to do this

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.