views:

38

answers:

4

Hello. I am looking for a way to have like a button in a web page, only when you press it the event handling is a program in a server. Like a trigger to execute a program in the server.

Is there any way to do this?

Cumpz.

A: 

A PHP script can execute a command on the server using one of the various functions like exec, system, and passthru. It can be a security nightmare, so be careful.

ceejayoz
A: 

You might want to look into something like: http://php.net/manual/en/book.exec.php

birderic
A: 

AJAX for the client part (sending notification about the button being pressed), and PHP (function exec() ou system() ).

William Briand
A: 

Like the others have said, exec, system, and passthru can be used for that, but I believe you will need to disable safe mode.

safe_mode = Off

http://php.net/manual/en/features.safe-mode.php

To add on to this answer, you can make a form

Page1.html

<html>
<head>
</head>
<body>
<form action="script.php" method="post">
<input type="submit" />
</form>
</body>
</html>

script.php

<?php
shell_exec("cmd");
echo "done";
?>

Someone correct me if I am wrong here.

imbadatjquery