Perodicaly grab/refresh txt file?
02-11-2007, 23:13
|
#1
|
|
cf.mega poster
Join Date: Jan 2004
Posts: 3,346
|
Perodicaly grab/refresh txt file?
Anyone know Of a php script that can connect via http to a site and download a copy of a text file and display it, but if the original source file is not available display the last copy it was able to successfully download?
Also I'd like it to auto refresh every 30 seconds and show the time that the copy was cached.
Text file is http://dragon2611.dyndns.org/wpc.txt (link may not work, depends if the pc running it is turned on or not) I want it available to http://101st-wolfpack.net/catchup (currently a redirect) I want to cache it since the machine its produced by is my home "server" and I usually turn it off when its not in use.
The clan use the channel for their weekly meeting and sometimes people can't make it or join late so its purpose is for them to catch up on what's happened.
__________________
It's Not a Bug It's a 'Feature'
|
|
|
03-11-2007, 08:29
|
#2
|
|
cf.addict
Join Date: Sep 2007
Posts: 248
|
Re: Perodicaly grab/refresh txt file?
You can use the php shell command to call a wget if you want.
__________________
Its Lsproc if you cant tell
And I have memorised signal levels, arent I sad
|
|
|
03-11-2007, 10:04
|
#3
|
Join Date: Jul 2003
Location: Poole, Dorset
Age: 23
Services: Sky+
V-Box
VM 10MBit
Posts: 9,762
|
Re: Perodicaly grab/refresh txt file?
PHP you can set to enable http:// includes in the php.ini file if you have access
|
|
|
03-11-2007, 10:14
|
#4
|
|
cf.addict
Join Date: Sep 2007
Posts: 248
|
Re: Perodicaly grab/refresh txt file?
Quote:
Originally Posted by Zeph
PHP you can set to enable http:// includes in the php.ini file if you have access
|
Surely that can be done via ini_set anyway...
__________________
Its Lsproc if you cant tell
And I have memorised signal levels, arent I sad
|
|
|
03-11-2007, 11:32
|
#5
|
Join Date: Jul 2003
Location: Poole, Dorset
Age: 23
Services: Sky+
V-Box
VM 10MBit
Posts: 9,762
|
Re: Perodicaly grab/refresh txt file?
Quite possibly, depends on the environment
|
|
|
03-11-2007, 11:32
|
#6
|
|
cf.mega poster
Join Date: Jan 2004
Posts: 3,346
|
Re: Perodicaly grab/refresh txt file?
I don't know how to code php, but I know someone who does and he's working on it for me
__________________
It's Not a Bug It's a 'Feature'
|
|
|
03-11-2007, 11:39
|
#7
|
Join Date: Jul 2003
Location: Poole, Dorset
Age: 23
Services: Sky+
V-Box
VM 10MBit
Posts: 9,762
|
Re: Perodicaly grab/refresh txt file?
OK why don't you set up a CRON job to periodically grab the file and place it in the web directory, say in your home directory (for root or the web server user) put a file called "getfile.sh" and in it put something like
Code:
#!/bin/sh
cd /var/www/html
wget http://dragon2611.dyndns.org/wpc.txt
Log in as the root/web server user and type "crontab -e" (no quotes), assuming vi opens which is usually default, press i and then move to the last line (if there are any already and add)
5 * * * * ~/getfile.sh > /dev/null 2>&1
then press esc, and type :wq and press enter
then make sure the getfile.sh file is executable by typing chmod +x getfile.sh and Bob's your uncle, assuming everything is OK that file should be updated every hour of every day at five minutes passed.
|
|
|
03-11-2007, 14:50
|
#8
|
|
cf.mega poster
Join Date: Jan 2004
Posts: 3,346
|
Re: Perodicaly grab/refresh txt file?
---------- Post added at 14:50 ---------- Previous post was at 14:50 ----------
Quote:
Originally Posted by Zeph
OK why don't you set up a CRON job to periodically grab the file and place it in the web directory, say in your home directory (for root or the web server user) put a file called "getfile.sh" and in it put something like
Code:
#!/bin/sh
cd /var/www/html
wget http://dragon2611.dyndns.org/wpc.txt
Log in as the root/web server user and type "crontab -e" (no quotes), assuming vi opens which is usually default, press i and then move to the last line (if there are any already and add)
5 * * * * ~/getfile.sh > /dev/null 2>&1
then press esc, and type :wq and press enter
then make sure the getfile.sh file is executable by typing chmod +x getfile.sh and Bob's your uncle, assuming everything is OK that file should be updated every hour of every day at five minutes passed.
|
I want it to update as soon as someone calls the page if the server is online.
__________________
It's Not a Bug It's a 'Feature'
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 11:59.
|