Forum Moderators: coopster

Message Too Old, No Replies

Copy remote page to my server

Copy remote page to my server

         

photocroatia

12:38 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



I have permission to use some data from a weather site, the page has a table, I strip the data I want and display on my site using php and format it to suit.

I am retrieving about 60 bits of data from that page, this is now taking a few seconds, I was wondering if it is possible to copy the page locally and then I run my script.

Is it possible to copy a page from a server to my site?

Than you.

Salsa

1:38 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



If allow_url_fopen is enabled in your php.ini (which it is by default) you can use fopen to open a remote file and than save it on your server in a directory where you've set up the needed write permissions. Also file_get_contents [us2.php.net] and file_put_contents will make the operation much simpler if your PHP is 4.3.0 or newer.

coopster

1:41 pm on Dec 14, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How are you doing it today? I guess I don't follow the whole, "copy it to my local server" part of the question here. If you want to retrieve the information on-the-fly, use one of PHP's file system functions [php.net], fopen() [php.net] perhaps.

photocroatia

1:50 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



Thank you.

What I am doing now is ripping the data I need from their webpage, I am only a novice so I am probably doing it wrong.

I have a script which I pass in the name of the place I want the details for, the name and the details are all in a html table, for example I say, for name "aa" get col 4.

I get that information and display it on my site.

Then I do the same for name "bb" etc etc etc

so when I get all 30 names and get them one at a time it takes a while.

I hope that makes sense.