Jump to content

Auto-Save a webpage


cxpzadan

Recommended Posts

There's a website that updates statistics approximately every hour, but they don't archive their pages so I have to physically be at my computer every time they update. I'm looking for a script that I could put on my website that would automatically visit the given URL every hour and save the page in a folder on my server.

 

I'd greatly appreciate it if someone could help.

Link to comment
https://forums.phpfreaks.com/topic/115703-auto-save-a-webpage/
Share on other sites

  Quote

Does it have to download the page images or just the page?

Images as well.

 

  Quote

Look into cron and wget. You don't even need php for this.

What is this? Unix? I don't have any experience with this, though it looks fairly straightforward. How would I do this?
Link to comment
https://forums.phpfreaks.com/topic/115703-auto-save-a-webpage/#findComment-594880
Share on other sites

  Quote

This....

 

/usr/bin/wget -N -E -H -k -K -p -P /home/${HOME}/domain.com/$(date +%s) http://domain.com/page.html

 

will save a copy of the complete (images and all) web page within a directory called domain.com/<seconds since epoch> in your home directory.

I made a crontab using this code, but nothing happens. It doesn't seem to work. There's no directory created anywhere on my server... How do I proceed?

Link to comment
https://forums.phpfreaks.com/topic/115703-auto-save-a-webpage/#findComment-595709
Share on other sites

I used the cronjob manager in Cpanel. It's set to update every minute, every hour, day, month...

In the command line I copied exactly what you suggested. /usr/bin/wget -N -E -H -k -K -p -P /home/${HOME}/domain.com/$(date +%s) http://domain.com/page.html  . Saved it... nothing happens.

Link to comment
https://forums.phpfreaks.com/topic/115703-auto-save-a-webpage/#findComment-595748
Share on other sites

Sorry, Ive never used cPanel or whatever interface it is your using to access cron. Generally though you need to tell cron when to execute a given command.

 

In a crontab file it would look something like....

 

# minute
#   # hour
#   #   # day of month
#   #   #   # month
#   #   #   #   # day of week
#   #   #   #   #
0   *   *   *   * /usr/bin/command

 

The above would execute /usr/bin/command every hour on the hour.

 

Link to comment
https://forums.phpfreaks.com/topic/115703-auto-save-a-webpage/#findComment-595939
Share on other sites

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.