note 99568 deleted from function.passthru by thiago

From: Date: Wed, 25 Aug 2010 07:45:05 +0000
Subject: note 99568 deleted from function.passthru by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172030@lists.php.net to get a copy of this message
Note Submitter: lb at bostontech dot net Reason: integrated ---- Thanks to "ignacio paz posse" below, I was able to solve a problem where I didn't want anything echoed back from the shell. on my system: exec, passthru, and exec all sent standard output back to the browser -- which is a problem in AJAX apps. For systems running PHP 5.2 and older, you can use the following code to get the MIME type, e.g. in this case .mp2/.mp3 files: ob_start(); passthru("file -bi -- ".escapeshellarg($sourceFile), $finfo); ob_get_contents(); ob_end_clean(); if ($finfo=='audio/mpeg') { }

« previous php.notes (#172030) next »