Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!2a02:590:1:1::196.MISMATCH!news.teledata-fn.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-Id: <2708352.dWV9SEqChM@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sun, 22 May 2011 13:06:43 +0200 User-Agent: KNode/4.4.7 Content-Transfer-Encoding: 7Bit Subject: Re: Detecting Redirected Output Newsgroups: comp.lang.php References: Followup-To: comp.lang.php MIME-Version: 1.0 Lines: 29 NNTP-Posting-Date: 22 May 2011 13:06:44 CEST NNTP-Posting-Host: 86edb7e6.newsspool2.arcor-online.net X-Trace: DXC=06gAWG9a@[?^cW`WBF>WQ Running under Win7, a script I'm writing needs to vary its behavior > depending upon whether or not the output from PHP is being redirected. > That is, I want to know from within the PHP script whether it's called as > > php foo.php > > or > > php foo.php > outfile > > None of the Output Control Functions appears to be helpful. > > Way back in DOS days, there was an IOCTL call which the program could > use to distinguish those two cases. Is there anything comparable in PHP? In PHP, yes; but not on Windows, as the POSIX extension is not available there (according to the manual): PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee