Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl including output of a PHP script? 1

Status
Not open for further replies.

danielhozac

Programmer
Aug 21, 2001
2,058
SE
I need to know how I could include the output of a PHP script in my Perl scripts. Anyone know how to do this? //Daniel
 
What would the PHP script be outputing - would it be a web page? In order for perl to be able to execute, and capture the output of, a PHP script, PHP would have to be built as a CGI interpreter. You would want to be able to do something like this:

@php_output_lines = `/path/to/php/script.php`; ### notice the use of backticks here

But I can't be much help since I haven't built PHP that way, but I know it can be done.

If PHP is built into the webserver, and the PHP script you want to run and capture the output of is a web page, then you might be able to use a package like LWP::Simple to retrieve the page into a scalar variable(or array?) and then do with it what you will.

HTH. Hardy Merrill
Mission Critical Linux, Inc.
 
I use PHP as a module, so I guess I will use LWP::Simple to do the job, thanks. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top