Jump to content

Run php in batch mode???


IrOnMaSk

Recommended Posts

hey guy, this is probably the dumbest question I ever ask. But can a php page be running in a batch mode, which means i want it to run in the background when i attemp to open it in a browser?

So i'm using php mail function to send out email. to do so i have to open it up in a browsers, but it will be just empty page so i don't want it to pop up. So i wrote a batch file to call the page.

@echo off
start iexplore.exe http://localhost/licensedb/Dev/home.php
ping 123.45.67.89 -n 1 -w 20000 > nul
taskkill /im iexplore.exe
start iexplore.exe http://localhost/licensedb/Dev/send_mail.php
ping 123.45.67.89 -n 1 -w 10000 > nul
taskkill /im iexplore.exe

thats the batch file calling to the 2 pages. So is there a way to just run it in the background without having them popping up?

 

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/242370-run-php-in-batch-mode/
Share on other sites

Use the php CLI ?

 

C:\path\to\php> php -f c:\path\to\phpfile.php

 

Word of warning, you may need to modify the file to run under the CLI (IE if you use $_SERVER['HOST'] or DOCUMENT_ROOT), but most of the time it will work.

 

Another option is to look for a lynx type browser or wget for windows.

thanx for reply premiso... i think its too hard to have it run in a batch mode... anyway, the batch file works fine. Anyone knows anything about autosys? i'm using it to schedule to run the batch file;  the job executes the batch but the commands in the batch are not executed which to open the two pages!!! but i think its the wrong place to ask here!!! don't know where to ask this complex question!!!  :'(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.