[TriLUG] HOW do you get PHP TO PARSE in PERL script?

Joseph Tate jtate at dragonstrider.com
Sat Aug 24 00:13:08 EDT 2002


You don't.  You put it in the perl script.

Let me see if I understand you correctly.

You want to get the output of a php script to use in your perl script 
right?  Do you care about the output of the php script?  If not, then 
just execute it as

#!/usr/bin/perl -w

`php your_php_script.php`;


If you want the output to be read back in, you have to use something like:

open PHPSCRIPT, "/usr/bin/php your_php_script.php|";
# 'which php' to see where your command line php interpreter is

Then you can parse the output from php like you would any open file.

If you need to pass variables into the php script, I'm afraid you're out 
of luck.  It really shouldn't be that difficult to port your PHP script 
to Perl though, unless it's thousands of lines.  Even a couple hundred 
lines should be doable in a couple of hours.

Let me know more about what system you're doing this on and what you're 
trying to accomplish and I can help you better.

Joseph

Reginald Tchume wrote:
> Thanks, Joseph. I am very new at this as I am not a programmer. So, how 
> would that commandline version of the PHP read or look like? And where 
> do I insert it in the PHP script?
> 
> 
>> From: Joseph Tate <jtate at dragonstrider.com>
>> Reply-To: trilug at trilug.org
>> To: trilug at trilug.org
>> Subject: Re: [TriLUG] HOW do you get PHP TO PARSE in PERL script?
>> Date: Fri, 23 Aug 2002 10:42:05 -0400
>>
>> Don't.  Use PHP to parse the php script.
>>
>> `php script`
>>
>> Launch the commandline version of php from within your php script and 
>> parse the output from that into perl.
>>
>> Joseph
>>
>> Reginald Tchume wrote:
>>
>>> Does anyone know how to get a PERL script to parse a PHP code?
>>>
>>> _________________________________________________________________
>>> MSN Photos is the easiest way to share and print your photos: 
>>> http://photos.msn.com/support/worldwide.aspx
>>>
>>> _______________________________________________
>>> TriLUG mailing list
>>>    http://www.trilug.org/mailman/listinfo/trilug
>>> TriLUG Organizational FAQ:
>>>    http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
>>
>>
>>
>>
>> _______________________________________________
>> TriLUG mailing list
>>    http://www.trilug.org/mailman/listinfo/trilug
>> TriLUG Organizational FAQ:
>>    http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
> 
> 
> 
> 
> 
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> _______________________________________________
> TriLUG mailing list
>    http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ:
>    http://www.trilug.org/~lovelace/faq/TriLUG-faq.html






More information about the TriLUG mailing list