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


Groups > comp.lang.php > #1762

Re: Detecting Redirected Output

Message-Id <2708352.dWV9SEqChM@PointedEars.de>
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2011-05-22 13:06 +0200
Subject Re: Detecting Redirected Output
Newsgroups comp.lang.php
References <c7idnTS_Udwd_EXQnZ2dnUVZ_jKdnZ2d@giganews.com>
Followup-To comp.lang.php

Followups directed to: comp.lang.php

Show all headers | View raw


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?

In PHP, yes; but not on Windows, as the POSIX extension is not available 
there (according to the manual):

<http://lmgtfy.com/?q=php+cli+redirection+-http>


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

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