Jump to content

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.