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


Groups > comp.lang.php > #1762

Re: Detecting Redirected Output

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 <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
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 <c7idnTS_Udwd_EXQnZ2dnUVZ_jKdnZ2d@giganews.com>
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<A9EHlD;3Yc24Fo<]lROoR18kF<OcfhCO;lLE37\F?SN5DZm8W4\YJN<T<8F<]0D<`9Ce:a8G7V1f5`oG`nj9IR36
X-Complaints-To usenet-abuse@arcor.de
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:1762

Followups directed to: comp.lang.php

Show key headers only | 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