Forum Moderators: coopster

Message Too Old, No Replies

Send php to execute in command

Sending a line of text from php to an executable

         

Twisted Mind

1:05 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



Hi Here is the situation...
In a script i want a line of text automaticly be launched so that command prompt executes it...
example

php does something like:

RUN: C:/myscript/ /madress:yours /body:text

if u understand...
doesnt matter what the line say i can fix that myself...
PLZ HELPZOZ MEZOZ

Twisted Mind

1:24 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



Answer my questionif u have any knowlege or if im at the wrong place

Anyango

2:04 pm on Nov 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




if

shell_exec

[php.net...]

works exactly like command prompt's shell command then you ll be easily able to send command line parameter to any executable and then in that executable you can capture it

like

shell_exec("DisplayName.exe Yourname");

however i niether have tested this method nor i can gaurantee that it ll work. all i can say is, it should.

Twisted Mind

2:22 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



I will try... but i actually dont need to open an .exe but run a line in cmd

Twisted Mind

2:33 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



it doesnt work :(

Twisted Mind

2:33 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



says unable to execute and i unsafemode'd my php.ini and restarted webhost thingy

Twisted Mind

8:18 am on Nov 22, 2005 (gmt 0)

10+ Year Member



If this would be of interest or is helpfull information im working on a w2003 server and webserver is IIS

jatar_k

3:40 pm on Nov 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> RUN: C:/myscript/ /madress:yours /body:text

what exactly are you trying to accomplish with this?
is there no other way to do it?

you could also try one of these functions

exec
passthru
system

farish

10:11 pm on Nov 22, 2005 (gmt 0)

10+ Year Member



" I will try... but i actually dont need to open an .exe but run a line in cmd "

when you type any command in command prompt that command is a executable file.
Use shell_exec(). I used it and works fine.

Twisted Mind

1:56 pm on Nov 23, 2005 (gmt 0)

10+ Year Member



Explaination:

I have A .exe file created by a college

This sends an email when you do something in cmd like
C:\mail2.exe /H:smtp.yourhost.com /:f myemail@yourhost.com /:t hisemail@yourhost.com
/:l the body of the mail wich should be editable in php so you could autogenerate a message...

understand now?

Twisted Mind

2:01 pm on Nov 23, 2005 (gmt 0)

10+ Year Member



Warning: shell_exec() [function.shell-exec]: Unable to execute 'd:\order_mail2\mail2.exe /h:smtp.danahermail.com /s:itshop@fluke.com /r:mathijs.segers@fluke.com /f:body_man_bverhoev.txt' in D:\Fluke_Mambo\exetest.php on line 3

Warning: shell_exec() [function.shell-exec]: Unable to execute 'd:\mail2_order\mail2_man_bverhoev.exe' in D:\Fluke_Mambo\exetest.php on line 2

when i try it on the rule i want to run and when i try to launch a .exe does this have anytin to do with IIS

Twisted Mind

10:44 am on Nov 25, 2005 (gmt 0)

10+ Year Member



so actually no one has a reply on my problem?

jatar_k

5:59 pm on Nov 25, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



did you try any of the other functions I mentioned?

Twisted Mind

12:50 pm on Nov 30, 2005 (gmt 0)

10+ Year Member



i tried them all...