PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!

  Author Author  
Name: Payam Naderi <contact>
Classes: 12 packages by
Country: Iran Iran
Innovation award
Innovation award
Nominee: 2x


  Detailed description   Download Download .zip .tar.gz  
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.

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

  Classes of Payam Naderi  >  PHP Execute Shell Command  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP Execute Shell Command
Base name: exec
Description: Execute system command piping input and output
Version: -
PHP version: 5
License: MIT/X Consortium License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image Networking Networking protocols, clients and servers View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Files and Folders Listing, accessing and manipulating files and folders View top rated classes
Group folder image Console Command line and console utilities View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  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

Download Download all files: exec.tar.gz exec.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.