#!/usr/bin/php $key, "field" => $field ); } $c=fopen($csv,"r"); $header=fgetcsv($c,false,$delim); $data=""; while ($row=fgetcsv($c,false,$delim)) { $p=get_replacements($header,$row); foreach ($items as $item) { $data.=sprintf("%s %s %s\n", getenv("ZAF_HOSTNAME"), preg_replace($p["patterns"],$p["replacements"],$item["key"]), preg_replace($p["patterns"],$p["replacements"],$item["field"]) ); } } fclose($c); if ($mode=="send") { $h = popen(getenv("ZAF_BIN")." send", "w"); fputs($h,$data); fclose($h); exit; } if ($mode=="stdout") { echo $data; exit; } fprintf(STDERR,"Bad mode $mode\n!"); exit(1);