PHP Classes
elePHPant
Icontem

PHP Execute Shell Command: Execute system command piping input and output

Recommend this page to a friend!
  Info   View files Documentation   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-06-29 (4 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 115 All time: 9,107 This week: 330Up
Version License PHP version Categories
exec 1.0.0MIT/X Consortium ...5Networking, PHP 5, Files and Folders, C...
Description Author

This package can execute system command piping input and output data sources.

It can take a given string and execute as a local command program.

The package can also connect the program input to a given input stream like a file or a network connection for instance to an HTTP server.

It can also define the destination of the regular and error output streams.

  Performance   Level  
Name: Payam Naderi <contact>
Classes: 13 packages by
Country: Iran Iran
Age: 36
All time rank: 224632 in Iran Iran
Week rank: 144 Up3 in Iran Iran Up
Innovation award
Innovation award
Nominee: 2x

 

Details

Poirot\Exec

Execute system commands.

__STDIN__

// Execute Command Line:
$exec = new ExeProc();
$re = $exec->exec("md5sum");

// Open Http Socket Connection:
$tcpClient = new \Poirot\Stream\WrapperClient('http://www.raya-media.com:80', 'r');
$stream = new \Poirot\Stream\Streamable($tcpClient->getConnect());
# pipe all http data as input for command(md5sum)
$stream->pipeTo($re->pipes()->stdin());
# close write input data
$re->pipes()->stdin()->getResource()->close();

// Read Output result, as stream:
$md5 = $re->pipes()->stdout()->readLine();

if ($re->pipes()->to(iExecDescriptor::XCDSC_STDERR) !== '') {
    // get stderr messages
    // ...
}

// Close Process:
$re->close();

var_dump($md5); // md5 hash of website content: fa59c70d613d4d0085b4d869c46288c9
  Files folder image Files  
File Role Description
Files folder imageInterfaces (2 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file ExeDescriptor.php Class Class source
Plain text file ExeProc.php Class Class source
Plain text file ExeProcuted.php Class Class source
Plain text file ExeProcutedPipes.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  Interfaces  
File Role Description
Files folder imageProcess (2 files)
  Plain text file iExec.php Class Class source
  Plain text file iExecDescriptor.php Class Class source

  Files folder image Files  /  Interfaces  /  Process  
File Role Description
  Plain text file iExecProcess.php Class Class source
  Plain text file iExecProcessPipe.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:115
This week:0
All time:9,107
This week:330Up