开发者

Pipe Screen to PHP (or any function for that matter)

开发者 https://www.devze.com 2023-02-18 09:09 出处:网络
I\'m looking for a way to pipe the output of the *nix screen command to another program. In theory I would like 开发者_开发百科to be able to do something like:

I'm looking for a way to pipe the output of the *nix screen command to another program. In theory I would like 开发者_开发百科to be able to do something like: screen -S test | php testscript.php and testscript.php receive it through php://stdin However I am open to other options if necessary.


#!/usr/bin/php
<?php
$fd = fopen("php://stdin","r");
$foo = "";
while ( !feof($fd) ){
    $foo .= fread($fd,1024);
}


fclose($fd);

//rest of script

command line: screen -S test |/path/to/php/script.php makes user script file is chmod to 755

0

精彩评论

暂无评论...
验证码 换一张
取 消