Right, I used 

        $output = shell_exec("perl browser.pl");
        echo "output";

as Radek suggested. To call my browser-sniffing perl script and read back what the 
script prints.
My trouble now is that the perl script, being called by the php script rather than by 
SSI, no longer seems to have the cgi environment variables to call on.

I can get the variable using
        
        $BRPHP = $_SERVER['HTTP_USER_AGENT'];

How do I pass this to the perl script? I've followed all the avenues suggested in the 
newbie guide.

The best I can seem to manage is to use exec() like so:

        $BRPHP = $_SERVER['HTTP_USER_AGENT'];
        $arr = array (1 => "$BRPHP" );
        exec (' ../cgi-bin/browser.pl', $arr );
        echo $arr[2];
        echo $arr[3];
        echo $arr[4];
        echo $arr[5];
        echo $arr[6];

The echo commands get me back the script's output, but am I passing $BRPHP to the perl 
script this way? (If the answer is "yes" then I can ask the folks at perl.org how to 
pick it up in the perl script).

Thanks,

Philip Pawley


At 26/12/03 12:29 -0500, you wrote:
>Check out shell_exec() and its siblings. I'd likely use it like so $output =
>shell_exec("perl myscript.pl"); and then do something with the $output
>variable
>
>R>
>
>> -----Original Message-----
>> From: Philip Pawley [mailto:[EMAIL PROTECTED]
>> Sent: December 26, 2003 12:07 PM
>> To: php-general
>> Subject: [PHP] Migrating from SSI and Perl
>>
>>
>> I am new to php.
>>
>> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>>
>> I would like to:
>> 1. use php to call the Perl script.
>> 2. then save the values the Perl script outputs as php variables.
>>
>> Can this be done? If so, how?
>>
>> Thanks,
>>
>> Philip Pawley

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to