tags:

views:

131

answers:

3

Hello All, I want to execute a php script after every one minute in background on windows OS, for this purpose i am using windows task scheduler in which i am giving the path of a php file after choosing Internet Explorer EXE, it works fine and after every minute opens that page in browser window and performs my wanted task.

Now the issue is that i do not want to open that browser window in front, i want this process to happen in background or at least close that browser on the fly after performing its task, i have also tried a .bat file for this process and i am killing the browser process after calling that php file, what happens is it closes the browser after opening it but does not execute that php file and does not perform my wanted task.

so in first way it performs task but keeps browser window open and in second way it closes window but does not perform task. My requirement is to execute that php code in background without opening any window in front and i want all this to happen on windows not linux. Any help from your side is welcome.

A: 

If the PHP is running on the same machine as your scheduler job, you can install WAMP (I'd imagine you already have?) and execute PHP from the command line:

C:\wamp\bin\php\php5.3.0\php.exe <path to your script>
meagar
actually i have to schedule this thing in the windows scheduler so that it runs automatically after specific interval in the background i have used this command into the scheduler command box asF:\Muhammad.Tanveer\wamp\bin\php\php5.2.6\php.exe http://localhost:8/waterflowmeter/test.phpbut what happens is the command window opens for a moment and closes but do not perform my task that i have i used in that php file i want to execute that script after one minute but it is doing nothing
Mohammad Tanveer
Yes, I'm suggesting that you alter your command in the scheduled job to run `F:\Muhammad.Tanveer\wamp\bin\php\php5.2.6\php.exe C:\wamp\www\waterflowmeter\test.php` - directly execute the script, rather than go through your local web server.
meagar
+1  A: 

Use php.exe as mentioned, or use wget for windows.

andreas
can you tell me how can i use wget for windows i have reviewed the link you have supplied but i am unable to understand the idea explained in that link
Mohammad Tanveer
@Mohammad Tanveer: Download Setup (http://gnuwin32.sourceforge.net/downlinks/wget.php); Run Setup; Start command line; type "wget -q -O - [your_url] > tmp.txt"; Done.
andreas
A: 

Assuming Apache on Linux you can set up a scheduled cron job of this command:

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

EDIT: Read your question a bit more thoroughly (walls of text are never conducive to good answers). As andreas says there is wget for Windows.

DisgruntledGoat