Reputation: 9373
I wanted to use my local server which is running Windows 7 to take advantage of the task scheduler to setup some cron jobs for some of my php files.
I can do this currently by:
start http://theurl
Which opens in my default browser. However I was hoping to accomplish this without physically opening a browser so when I come back to my computer after a few days I don't have millions of Chrome windows open.
How can I load a URL in Task scheduler without opening a browser client via cmd
?
Upvotes: 4
Views: 13497
Reputation: 9373
I was able to accomplish the cron job by using a program called wget. I setup task scheduler to run the wget.exe at my specified time with these arguments:
wget -q -O - http://theurl.com > tmp.txt
This would load the website and store it to a temporary text file which is overwritten next time it is used.
Upvotes: 4
Reputation: 72682
If you just want to run some php files you don't need a browser. You can just run it from the commandline:
php -f /path/to/php/file.php
However if you really need to access a page you can do several things like: file_get_contents()
or making a cURL request from PHP.
Upvotes: 3
Reputation: 59709
You don't need cmd or shell access. If your host has the HTTP wrapper enabled, a call to file_get_contents()
is all you need:
file_get_contents( 'http://theurl');
You can also use fopen()
if you're not interested in the response from the server.
Upvotes: 1