Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to figure out how to open and close IE to run a PHP page on a daily run.Not sure what to do once I get to the "Start a Program" section of the task wizard to achieve this.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You need to invoke php with your script as an argument:

"C:\Program Files\PHP\php.exe" -f "C:\Path\to\your\script.php"

The -f switch is from the linux version, but I believe it's the same for Windows; you'll also need to specify the correct path to php.exe, wherever that is.

share|improve this answer
    
Worked like a charm, thank you! –  case Jan 6 '11 at 11:33

If you can, run your php script locally (as SmallClanger suggests); create a .bat script so you link this .bat into task scheduler.

If you must call the php page remotely, create always a bat script with this line: "C:\Program Files\Internet Explorer\iexplore.exe" www.yourdomain.com/page.php

If you want to close the Internet explorer windows, try with Windows Script Host and WScript.Shell object.

share|improve this answer
1  
Good point, I was assuming a local script, though the OP does say 'page'. If it's the latter, there are some tools around that can automate refreshes of remote pages, but I'd favour a script with something like wget, which will save you having to load IE each time the task is triggered. –  SmallClanger Jan 5 '11 at 12:33
    
SmallClanger tell right: wget is the best choise. Download the windows version from users.ugent.be/~bpuype/wget. –  lg. Jan 5 '11 at 12:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.