Open url via cmd without opening a browser

I wanted to use my local server running Windows 7 to use the task scheduler to install some cron jobs for some of my php files.

I can do it now: start http://theurl

What opens in my browser by default. However, I hoped to do this without physically opening the browser, so when I get back to my computer in a few days, I don't have millions of Chrome windows left.

How to load url into task scheduler without opening client browser via cmd ?

+4
source share
3 answers

I was able to complete the cron job using a program called wget . I am setting up a task scheduler to run wget.exe at the specified time with these arguments:

  wget -q -O - http://theurl.com > tmp.txt 

This will download the website and save it in a temporary text file that will be overwritten next time.

+4
source

If you just want to run some php files, you don’t need a browser. You can simply run it from the command line:

 php -f /path/to/php/file.php 

However, if you really need to access the page, you can do several things like: file_get_contents() or make a cURL request from PHP.

+3
source

You do not need access to cmd or shell. If your host has the HTTP shell enabled, you need to call file_get_contents() :

 file_get_contents( 'http://theurl'); 

You can also use fopen() if you are not interested in the response from the server.

+1
source

All Articles