将php参数传递给命令行脚本而不关闭连接

时间:2013-10-09 08:14:20

标签: php perl command-line-arguments

我有一个Perl脚本,它打开与交换机的连接以传递命令。

我有一个PHP生成的页面,它将命令发送到Perl脚本。

效果相当好。 我的问题是,对于发送的每个命令,Perl脚本必须打开连接,发送命令,关闭连接。有些交换机在国外,所以需要很长时间才能连接到..

我正在寻找是否有办法打开连接,然后发送在网页表单上生成的命令。

因此,用户将启动连接的打开,发送他们想要的所有命令,然后选择关闭连接。

还没弄明白怎么做。

我的限制是Perl是我现在打开连接到交换机的唯一方式,因为我使用的模块(DEFINITY_ossi.pm)仅适用于Perl。 这是Perl代码的摘要:

BEGIN { require "./DEFINITY_ossi.pm"; import DEFINITY_ossi; }

my $DEBUG = 0;
my $progname="pbxMultiCommand.pl";
($loc, $rootcommand,$count,$filename)=@ARGV;
 $c=@ARGV;
if ($c eq 0) {&help};
.......
 our $node = new DEFINITY_ossi($loc, $DEBUG);
unless( $node && $node->status_connection() ) {
    print  "ERROR: Login failed for ". $node->get_node_name();
    die("ERROR: Login failed for ". $node->get_node_name() );
 }
 open (OUT,">$filename");


for ($i=$extstart;$i<=$max;$i++)
{
    $command="$root $i";
    $node->pbx_command("$command");
.....
在php方面,我正在调用脚本(一旦捕获了参数),就像这样:

$commandexec="perl $script '$loc' \"$command\" $count $file 2>&1";
$output=shell_exec($commandexec);
事先得到你的帮助。

0 个答案:

没有答案
相关问题