Hi there
Currently I have a script which runs every hour via cron. The command I'm using is "php /var/www/html/news.php > /var/www/html/index.html".
I have a couple of issues with this:
1) It seems to add the line "Content-type: text/html" to the very top of the HTML file when it's generated.
2) The script reads quite a lot of data and takes about 3 minutes to run. The page is built gradually and looks broken for 3 minutes of every hour, until the script has finished and the page is fully built.
What I'd like to do is replace this cron command and execute a php file that perhaps does the following:
1) executes the script
2) saves it to a file index-temp.html
3) waits 3 minutes until the file has fully finished
4) overwrites the previous index.html with the new one.
Can anyone suggest what the best practice would be, and what code I might use to do it?
Thanks in advance for your help.
PHP command to run a script and save resulting code
Moderator: General Moderators
Re: PHP command to run a script and save resulting code
I would eliminate the output part of the crontab command (" > /var/www/html/index.html") and have your news.php script write to that file using php instead.
By doing this, you can either write the contents to index.html all at once after the script is done doing its thing, or you can write to a temp file and have php copy it over to index.html once it's done.
By doing this, you can either write the contents to index.html all at once after the script is done doing its thing, or you can write to a temp file and have php copy it over to index.html once it's done.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: PHP command to run a script and save resulting code
Thanks. Is there much code? I don't know how to do it myself, would it require hiring a developer do you reckon?
Cheers
Simon
Cheers
Simon