How can I invoke a PHP script from Perl?

前端 未结 3 842
刺人心
刺人心 2021-01-12 18:40

How can I call a PHP script from a Perl script and get its output as a variable?

3条回答
  •  无人及你
    2021-01-12 19:20

    It may be easier to distill this into its core problem, how to invoke another program from perl, which is answered in the perlop manpage's info about qx (or look up the perl qx command through some other means). That informs you how to run an external program and get the output, assuming that your PHP script is actually functional when called through the command line (can you run it via php your-php-script.php ?).

    If your script is only functional through an HTTP request, then you need to use something like the LWP::UserAgent or WWW::Mechanize to get the content through its URL, similarly to how you would need to use HTTP_Request.php in PHP.

提交回复
热议问题