1
I need to schedule the sending of an email dynamically on a windows server running IIS. I have the following code in PHP:
class AgendarTarefaWindow{
public function agendar($nome, $data, $tarefa){
$array = explode(' ',$data);
$comando = 'SCHTASKS /Create /SC ONCE /TN '.$nome.' /TR "'.$tarefa.'" /ST '.$array[1].' /SD '.$array[0].' /F ';
$dados = system($comando,$resultado);
var_dump($dados, $resultado, $comando);
}
public function excluirAgendamento($tarefa){
exec('schtasks /Delete /TN '.$tarefa.' /F');
}
}
$agenda = new AgendarTarefaWindow();
$agenda->agendar('ncccTeste', date('d/m/Y H:i:s',strtotime( "+2 minute",strtotime(date('Y-m-d H:i:s')))), 'php -f C:\inetpub\wwwroot\ClickFood\obj.php');
If I call him via command line: php -f addressFile it works perfectly. Already when I call it by browser the script just doesn’t work.
If anyone knows what it can be I’m very grateful.
The result of var_dump() and the following:
string(0) ""
int(-2147467259)
string(121) "SCHTASKS /Create /SC ONCE /TN ncccTeste /TR "php -f C:\inetpub\wwwroot\ClickFood\obj.php" /ST 14:30:00 /SD 23/07/2015 /F "
When you use the browser, what is the result of the command
var_dump()
? Edit your question and enter these values please.– user3603
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero