[Chicago-talk] transl. php to perl?
Richard Reina
richard at rushlogistics.com
Mon Mar 28 05:24:52 PST 2005
perl is the only language I know, and even that is
debatable. So any of you know enogh php to help me
translate the script below? I know which lines are the
comments that's about it.
#!/usr/bin/php4 -q
<?php
ob_implicit_flush(true);
set_time_limit(6);
$in = fopen("php://stdin","r");
$stdlog = fopen("/var/log/asterisk/my_agi.log", "w");
// toggle debugging output (more verbose)
$debug = false;
// Do function definitions before we start the main
loop
function read() {
global $in, $debug, $stdlog;
$input = str_replace("\n", "", fgets($in, 4096));
if ($debug) fputs($stdlog, "read: $input\n");
return $input;
}
// parse agi headers into array
while ($env=read()) {
$s = split(": ",$env);
$agi[str_replace("agi_","",$s[0])] = trim($s[1]);
if (($env == "") || ($env == "\n")) {
break;
}
}
More information about the Chicago-talk
mailing list