Re: PIPE

From: Date: Tue, 15 Apr 2003 19:14:48 +0000
Subject: Re: PIPE
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-35227@lists.php.net to get a copy of this message
proba con popen Description int popen ( string command, string mode) Opens a pipe to a process executed by forking the command given by command. Returns a file pointer identical to that returned by fopen(), except that it is unidirectional (may only be used for reading or writing) and must be closed with pclose(). This pointer may be used with fgets(), fgetss(), and fputs(). If an error occurs, returns FALSE. $fp = popen ("/bin/ls", "r"); Note: If the command to be executed could not be found, a valid resource is returned. This may seem odd, but makes sense; it allows you to access any error message returned by the shell: <?php error_reporting(E_ALL); /* Add redirection so we can get stderr. */ $fp = popen('/path/to/spooge 2>&1', 'r'); echo "'$fp'; " . gettype($fp) . "\n"; $read = fread($fp, 2096); echo $read; pclose($fp); ?> See also pclose(). ----- Original Message ----- From: "Pablo E. Siciliano" <psiciliano@puentenet.com> To: <lista@phpes.com> Sent: Tuesday, April 15, 2003 3:42 PM Subject: [PHP-ES] PIPE Hola Lister@s!!! Alguien sabe como abrir un archivo a un pipe en PHP (Para los que conocen algo de Perl, que supongo son muchos en esta lista, algo como open MAIL, "|/sbin/sendmail -t"). Intenté hacerlo con fopen( $file=arch("|/sbin/sendmail","w")), pero no funcionó. No se guien por el ejemplo, quiero abrir un pipe a otra aplicación, no a sendmail. Se que para eso tengo mail(). Saludos!! Pablo E. Siciliano PuenteNet.com Depto. Programación. 4329-0137 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.470 / Virus Database: 268 - Release Date: 08/04/03

« previous php.general.es (#35227) next »