PHP Classes

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    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 136 This week: 1All time: 9,258 This week: 560Up
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.

Picture of Payam Naderi
  Performance   Level  
Name: Payam Naderi <contact>
Classes: 15 packages by
Country: United States United States
Age: 41
All time rank: 2019286 in United States United States
Week rank: 106 Up12 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Documentation

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:136
This week:1
All time:9,258
This week:560Up