Jump to content

[SOLVED] Including a PERL script in my PHP (with passed variables) -- EGAD!


Jackanape

Recommended Posts

This has been annoying me for weeks, and driving me crazy for the last 24 hours.

 

I have been trying to include a PERL script into my php script (phpBB3), while also passing the query string to modify the output.

 

I've got it working fine for the basic output:

$output = `/usr/bin/perl /home/mysite/public_html/cgi-bin/scriptdirectory/index.cgi`; 
$output3 = shell_exec('/home/mysite/public_html/cgi-bin/scriptdirectory/index.cgi');

 

but can't pass any variables such as:

 

$output2 = `/usr/bin/perl /home/mysite/public_html/cgi-bin/scriptdirectory/index.cgi?o=list&s=mystyle14`; 

 

I'm at my wits' end...can anyone shed some light on this for me?

Querystrings are part of http, and are not how arguments are generally passed to a perl script. Have you tried calling this script via a url? eg;

 

$output = file_get_contents('http://yoursite.com/cgi-bin/scriptdirectory/index.cgi?o=list&s=mystyle14');

WOW!

 

Mind-boggling, indeed!

 

The file_get_contents() does the trick, splendidly, and may I say, after spending days looking for the solution to this problem, this was the FIRST mention of that function I came across.

 

I'm not sure exactly how it works, or why, and eventually, would like to find out how it could work with shell_exec(), but this is exactly what I needed!

 

Here's how I ended up including it, for the curious who may come along in the future (remember the template is for phpBB3):

$output = file_get_contents('http://www.wannatalkpoker.com/cgi-bin/calendar/index.cgi');

$output = ereg_replace( "Content-type: text/html", "", $output );

$template->assign_vars(array(
      "SCHEDULE" => $output,         
   ));  

 

Thanks again!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.