-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathphp.php
More file actions
24 lines (18 loc) · 551 Bytes
/
php.php
File metadata and controls
24 lines (18 loc) · 551 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
require __DIR__ . '/../vendor/autoload.php';
$launcher = new Clue\React\Shell\ProcessLauncher();
$shell = $launcher->createDeferredShell('php -a');
$shell->setBounding("echo '{{ bounding }}';");
$shell->execute('$var = "hello";');
$shell->execute('$var = $var . " world";');
$shell->execute(<<<'CODE'
for ($i=0; $i<3; ++$i) {
echo $var . '!';
}
CODE
)->then(function ($output) {
echo 'Program output: ' . PHP_EOL . $output . PHP_EOL;
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
$shell->end();