At 11:53 AM -0600 2/18/11, Mike Blezien wrote:
Hello,

this is kinda of a crossover to PHP which I'm not that fimilar with.

I have a Perl script that needs to call up a specific function from a PHP script, Entry.php calls "Social_preformPost()" function. I simply need to pass 2 variables to this function, SocialpreformPost($id,$message)

My question is do I need to use the require "./Entry.php" then call the function similar to the way you'd call a regular sub routine or how is this done?

Perl programs are compiled and executed by a Perl interpreter ('perl' on most systems). PHP programs are compiled and executed by a PHP interpreter ('php' or as part of a web server). Since the languages have different syntax, modules written in one language will not execute by the interpreter of the other language.

Your choices include:

1. Rewrite the PHP module in Perl. This is best for long-term use.

2. Find a PHP interpreter written in Perl. See <http://search.cpan.org/search?m=all&q=PHP&s=11>

3. Call the PHP interpreter as an external process from your Perl program., e.g., "my @php_output = qx(php myprogram.php);" You will have to write a main PHP program to call the desired routine and return the results appropriately.

I have never used PHP, so can't advise further.

Good luck.

--
Jim Gibson
[email protected]

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to