Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1759

Re: Detecting Redirected Output

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Detecting Redirected Output
Date 2011-05-21 23:14 -0400
Organization A noiseless patient Spider
Message-ID <ir9v2l$rnv$2@dont-email.me> (permalink)
References <c7idnTS_Udwd_EXQnZ2dnUVZ_jKdnZ2d@giganews.com>

Show all headers | View raw


On 5/21/2011 9:06 PM, Bob Smith wrote:
> 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?
>

Nope.  Not possible in PHP.  And it shouldn't be, either.  The purpose 
of a redirect is to be able to save the output.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Detecting Redirected Output Bob Smith <bsmith@sudleydeplacespam.com> - 2011-05-21 21:06 -0400
  Re: Detecting Redirected Output Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-21 23:14 -0400
    Re: Detecting Redirected Output "Twayne" <nobody@devnull.spamcop.net> - 2011-05-22 09:04 -0400
  Re: Detecting Redirected Output Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-05-22 13:06 +0200
    Re: Detecting Redirected Output Bob Smith <bsmith@sudleydeplacespam.com> - 2011-05-22 12:17 -0400

csiph-web