Re: Script running under Command Prompt or Browser or some other application?
Re: Script running under Command Prompt or Browser or some other application?
am 28.11.2007 19:26:28 von Jerry Stuckle
Kailash Nadh wrote:
> On Nov 28, 5:34 am, Ojas wrote:
>> Hi!,
>>
>> I just out of curiosity want to know how top detect the client side
>> application under which the script is getting run. I mean to ask the
>> how to know whether the script is running under Command Prompt or
>> Browser or some other application?
>>
>> Ojas.
>
> Yep, when a php script is run from the commandline, the two variables
> $argc and $argv (commandline arguments) are registered.
> They might be empty, but they still would be registered when being run
> from the commandline (and not when not in the commandline)
> http://uk.php.net/features.commandline
>
> --
> Kailash Nadh | http://kailashnadh.name
>
But that's server side. He asked about client side. And the answer is
there is no good way.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Script running under Command Prompt or Browser or some other
am 28.11.2007 20:52:15 von unknown
Post removed (X-No-Archive: yes)
Re: Script running under Command Prompt or Browser or some other application?
am 29.11.2007 13:46:02 von Jerry Stuckle
Ojas wrote:
> On Nov 28, 11:26 pm, Jerry Stuckle wrote:
>> Kailash Nadh wrote:
>>> On Nov 28, 5:34 am, Ojas wrote:
>>>> Hi!,
>>>> I just out of curiosity want to know how top detect the client side
>>>> application under which the script is getting run. I mean to ask the
>>>> how to know whether the script is running under Command Prompt or
>>>> Browser or some other application?
>>>> Ojas.
>>> Yep, when a php script is run from the commandline, the two variables
>>> $argc and $argv (commandline arguments) are registered.
>>> They might be empty, but they still would be registered when being run
>>> from the commandline (and not when not in the commandline)
>>> http://uk.php.net/features.commandline
>>> --
>>> Kailash Nadh |http://kailashnadh.name
>> But that's server side. He asked about client side. And the answer is
>> there is no good way.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> Thanks to all of you for replying but i still think there should be a
> way to know that. Actually someone may have to implement a check on
> the basis of that. Unavailability of the functionality can break the
> logic!!
>
> Ojas
>
Sorry - knowing what's running on the client side depends on the client
telling you. And that's not reliable.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Script running under Command Prompt or Browser or some otherapplication?
am 06.12.2007 12:45:33 von Norman Peelman
Jerry Stuckle wrote:
> Kailash Nadh wrote:
>> On Nov 28, 5:34 am, Ojas wrote:
>>> Hi!,
>>>
>>> I just out of curiosity want to know how top detect the client side
>>> application under which the script is getting run. I mean to ask the
>>> how to know whether the script is running under Command Prompt or
>>> Browser or some other application?
>>>
>>> Ojas.
>>
>> Yep, when a php script is run from the commandline, the two variables
>> $argc and $argv (commandline arguments) are registered.
>> They might be empty, but they still would be registered when being run
>> from the commandline (and not when not in the commandline)
>> http://uk.php.net/features.commandline
>>
>> --
>> Kailash Nadh | http://kailashnadh.name
>>
>
> But that's server side. He asked about client side. And the answer is
> there is no good way.
>
>
If the OP is trying to determine weather the program is running via a
internet server/browser or command line (terminal) then check this out.
Either of these two lines will tell you:
echo PHP_SAPI."\n\r";
or:
echo php_sapi_name()."\n";
....see: http://us.php.net/manual/en/features.commandline.php
---
Norm
Re: Script running under Command Prompt or Browser or some otherapplication?
am 06.12.2007 12:45:33 von Norman Peelman
Jerry Stuckle wrote:
> Kailash Nadh wrote:
>> On Nov 28, 5:34 am, Ojas wrote:
>>> Hi!,
>>>
>>> I just out of curiosity want to know how top detect the client side
>>> application under which the script is getting run. I mean to ask the
>>> how to know whether the script is running under Command Prompt or
>>> Browser or some other application?
>>>
>>> Ojas.
>>
>> Yep, when a php script is run from the commandline, the two variables
>> $argc and $argv (commandline arguments) are registered.
>> They might be empty, but they still would be registered when being run
>> from the commandline (and not when not in the commandline)
>> http://uk.php.net/features.commandline
>>
>> --
>> Kailash Nadh | http://kailashnadh.name
>>
>
> But that's server side. He asked about client side. And the answer is
> there is no good way.
>
>
If the OP is trying to determine weather the program is running via a
internet server/browser or command line (terminal) then check this out.
Either of these two lines will tell you:
echo PHP_SAPI."\n\r";
or:
echo php_sapi_name()."\n";
....see: http://us.php.net/manual/en/features.commandline.php
---
Norm
Re: Script running under Command Prompt or Browser or some otherapplication?
am 06.12.2007 14:28:21 von Jerry Stuckle
Norman Peelman wrote:
> Jerry Stuckle wrote:
>> Kailash Nadh wrote:
>>> On Nov 28, 5:34 am, Ojas wrote:
>>>> Hi!,
>>>>
>>>> I just out of curiosity want to know how top detect the client side
>>>> application under which the script is getting run. I mean to ask the
>>>> how to know whether the script is running under Command Prompt or
>>>> Browser or some other application?
>>>>
>>>> Ojas.
>>>
>>> Yep, when a php script is run from the commandline, the two variables
>>> $argc and $argv (commandline arguments) are registered.
>>> They might be empty, but they still would be registered when being run
>>> from the commandline (and not when not in the commandline)
>>> http://uk.php.net/features.commandline
>>>
>>> --
>>> Kailash Nadh | http://kailashnadh.name
>>>
>>
>> But that's server side. He asked about client side. And the answer is
>> there is no good way.
>>
>>
>
>
> If the OP is trying to determine weather the program is running via a
> internet server/browser or command line (terminal) then check this out.
>
> Either of these two lines will tell you:
>
> echo PHP_SAPI."\n\r";
>
> or:
>
> echo php_sapi_name()."\n";
>
> ...see: http://us.php.net/manual/en/features.commandline.php
>
> ---
> Norm
>
That wasn't the op's question.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Script running under Command Prompt or Browser or some otherapplication?
am 06.12.2007 14:28:21 von Jerry Stuckle
Norman Peelman wrote:
> Jerry Stuckle wrote:
>> Kailash Nadh wrote:
>>> On Nov 28, 5:34 am, Ojas wrote:
>>>> Hi!,
>>>>
>>>> I just out of curiosity want to know how top detect the client side
>>>> application under which the script is getting run. I mean to ask the
>>>> how to know whether the script is running under Command Prompt or
>>>> Browser or some other application?
>>>>
>>>> Ojas.
>>>
>>> Yep, when a php script is run from the commandline, the two variables
>>> $argc and $argv (commandline arguments) are registered.
>>> They might be empty, but they still would be registered when being run
>>> from the commandline (and not when not in the commandline)
>>> http://uk.php.net/features.commandline
>>>
>>> --
>>> Kailash Nadh | http://kailashnadh.name
>>>
>>
>> But that's server side. He asked about client side. And the answer is
>> there is no good way.
>>
>>
>
>
> If the OP is trying to determine weather the program is running via a
> internet server/browser or command line (terminal) then check this out.
>
> Either of these two lines will tell you:
>
> echo PHP_SAPI."\n\r";
>
> or:
>
> echo php_sapi_name()."\n";
>
> ...see: http://us.php.net/manual/en/features.commandline.php
>
> ---
> Norm
>
That wasn't the op's question.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Script running under Command Prompt or Browser or some otherapplication?
am 07.12.2007 22:11:56 von Norman Peelman
Jerry Stuckle wrote:
> Norman Peelman wrote:
>> Jerry Stuckle wrote:
>>> Kailash Nadh wrote:
>>>> On Nov 28, 5:34 am, Ojas wrote:
>>>>> Hi!,
>>>>>
>>>>> I just out of curiosity want to know how top detect the client side
>>>>> application under which the script is getting run. I mean to ask the
>>>>> how to know whether the script is running under Command Prompt or
>>>>> Browser or some other application?
>>>>>
>>>>> Ojas.
>>>>
>>>> Yep, when a php script is run from the commandline, the two variables
>>>> $argc and $argv (commandline arguments) are registered.
>>>> They might be empty, but they still would be registered when being run
>>>> from the commandline (and not when not in the commandline)
>>>> http://uk.php.net/features.commandline
>>>>
>>>> --
>>>> Kailash Nadh | http://kailashnadh.name
>>>>
>>>
>>> But that's server side. He asked about client side. And the answer
>>> is there is no good way.
>>>
>>>
>>
>>
>> If the OP is trying to determine weather the program is running via
>> a internet server/browser or command line (terminal) then check this out.
>>
>> Either of these two lines will tell you:
>>
>> echo PHP_SAPI."\n\r";
>>
>> or:
>>
>> echo php_sapi_name()."\n";
>>
>> ...see: http://us.php.net/manual/en/features.commandline.php
>>
>> ---
>> Norm
>>
>
> That wasn't the op's question.
>
I guess I took it to mean he might want to provide either a browser
interface or a terminal interface based on how the program was being
run. Possibly for scripts being run on the client machine. But i see
from the rest of the thread the true meaning of his question is now evident.
---
Norm
Re: Script running under Command Prompt or Browser or some otherapplication?
am 07.12.2007 22:11:56 von Norman Peelman
Jerry Stuckle wrote:
> Norman Peelman wrote:
>> Jerry Stuckle wrote:
>>> Kailash Nadh wrote:
>>>> On Nov 28, 5:34 am, Ojas wrote:
>>>>> Hi!,
>>>>>
>>>>> I just out of curiosity want to know how top detect the client side
>>>>> application under which the script is getting run. I mean to ask the
>>>>> how to know whether the script is running under Command Prompt or
>>>>> Browser or some other application?
>>>>>
>>>>> Ojas.
>>>>
>>>> Yep, when a php script is run from the commandline, the two variables
>>>> $argc and $argv (commandline arguments) are registered.
>>>> They might be empty, but they still would be registered when being run
>>>> from the commandline (and not when not in the commandline)
>>>> http://uk.php.net/features.commandline
>>>>
>>>> --
>>>> Kailash Nadh | http://kailashnadh.name
>>>>
>>>
>>> But that's server side. He asked about client side. And the answer
>>> is there is no good way.
>>>
>>>
>>
>>
>> If the OP is trying to determine weather the program is running via
>> a internet server/browser or command line (terminal) then check this out.
>>
>> Either of these two lines will tell you:
>>
>> echo PHP_SAPI."\n\r";
>>
>> or:
>>
>> echo php_sapi_name()."\n";
>>
>> ...see: http://us.php.net/manual/en/features.commandline.php
>>
>> ---
>> Norm
>>
>
> That wasn't the op's question.
>
I guess I took it to mean he might want to provide either a browser
interface or a terminal interface based on how the program was being
run. Possibly for scripts being run on the client machine. But i see
from the rest of the thread the true meaning of his question is now evident.
---
Norm