Jump to content

help with exec


kranthi117

Recommended Posts

@thorpe

 

if this is what u r saying

<?php
exec("dir",&$out,$no);
var_dump($out);
var_dump($no);
?>

 

i tried it but it did not work....

ny ways i m not trying to get a text output.. i m trying to start an exe file tru php..

 

@cooldude832 dnt get u how can i write the output of exec to a file, without using a php variable

Link to comment
https://forums.phpfreaks.com/topic/97619-help-with-exec/#findComment-499611
Share on other sites

You don't need to write to a file to use it on Windows.

 

If you just want the output to go to the screen, use passthru()

If you want to store it in a variable, you will use exec() like so:

 

$cmd = 'hostname';
$output = array();
$return_var = null;
exec($cmd,$output, $return_var);
print "Command run: $cmd\n";
print "Return Value: $return_var\n";
print "Output:\n".implode("\n",$output);

Link to comment
https://forums.phpfreaks.com/topic/97619-help-with-exec/#findComment-499626
Share on other sites

i dont think you can open applications using php command line execution

you can communicate to application using commands

 

not sure you can open notepad or any other application

 

please reply if  i am wrong

 

You are wrong.

 

exec() is a function in php capable of executing an external program be it shell cmd or an ambiguous macro program made by a user.

 

It is very common for MMORPG people to build macro's that "harvest" game resources and then report back to a remote server their findings via a php/cron/exec combo.

Link to comment
https://forums.phpfreaks.com/topic/97619-help-with-exec/#findComment-500518
Share on other sites

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.