|
Posted by Ojas on 12/05/07 09:18
On Nov 29, 4:51 pm, Bruno Rafael Moreira de Barros
<brunormbar...@gmail.com> wrote:
> >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!!
>
> Not wanting to be pessimistic or contraditory, I think what he meant
> was how to find a way to know which application executed the request.
>
> If you open a request to a PHP script from another PHP script, there
> will be a PHP user agent (dont know its name from my head), whilst on
> a browser, the browsers details will be sent. Lets just say with PHP,
> you can check if its command line by checking IF $argc and $argv
> exist, to check if its a browser, compare it to a list of known
> browsers (PHP.net has one huge file for that) and if its not run on
> command line, if its not run on a known browser, then it can only be
> another application.
>
> Is that what you were looking to know, Ojas?
You are right Bruno Rafael. I am willing to know the type of
application sending request to the server to run a PHP script (i think
it should be clear to all other ones that i am not asking for how
script will run on client side.)
As you have specified, if the request has been sent through command
line, $argc & $arv will exists whether having any values or not but
since we can access these values from $_SERVER (or $_ENV not sure
about it) which itself is an array, not set $_SERVER['argc'] is
equivalent to null $_SERVER['argc'], accessing the $_SERVER['argc']
will result to null values in both cases, then how one can distinguish
these cases?
Ojas.
[Back to original message]
|