","\n",str_replace("","\n",str_replace(" ","\n",$inh))));
for ($iu=0; $iu') {
$wo=true;
} else if (substr($inh, $iu, 1) == '<') {
$wo=false;
} else if ($wo) {
$huhr.=substr($inh, $iu, 1);
}
}
return $huhr;
}
}
if (isset($_GET['xml'])) { // surfing the net
$gxml=$_GET['xml'];
} else if (isset($_POST['xml'])) { // surfing the net
$pxml=$_POST['xml'];
} else if (isset($argv)) { // command line
$numargs = sizeof($argv);
if ($numargs <= 1) {
if (PHP_OS == 'WINNT') {
echo '$ XML File(spec) or URL: ';
$line = stream_get_line(STDIN, 1024, PHP_EOL);
} else {
$line = readline('$ XML File(spec) or URL: ');
}
$gxml=urlencode($line);
} else {
$gxml=$argv[1];
array_push($ziparr, $argv[1]);
for ($iu=2; $iu<$numargs; $iu++) {
$gxml.=' ' . $argv[$iu];
array_push($ziparr, $argv[$iu]);
}
$gxml=urlencode($gxml);
}
}
$jobbits="Job Description Goes Here"; // fill this in
function oursimplexml_load_file($inxml) {
if (isset($_GET['generic']) || isset($_POST['generic'])) {
return simplexml_load_file($inxml);
} else {
$outrpts=explode(".xm", str_replace(".XML",".xml",str_replace(".Xml",".xml",$inxml)));
$outrpt="";
if (sizeof($outrpts) > 1) {
$bz="";
$prebz="";
$outrpt=$outrpts[0] . $prebz . $bz . ".csv";
while (file_exists($outrpts[0] . ".csv" . $bz)) {
if (("" . $bz) == "") {
$prebz="_";
$bz=1;
} else {
$bz++;
}
$outrpt=$outrpts[0] . $prebz . $bz . ".csv";
}
}
// Start of business logic piecing together CSV report ...
$cont=file_get_contents($inxml);
$detailrec='';
$detailrec='"col1value","col2value"'; // you do more in depth work to get to this point via $cont
if (trim($detailrec) != "") {
$headerrec='"col1label","col2label"'; // you do more in depth work to get a header record as required via $cont
if ($outrpt != "" && 1 == 1) {
if ($headerrec != "") { $headerrec.="\n"; }
file_put_contents($outrpt, $headerrec . $detailrec);
exit;
} else {
if ($headerrec != "") { $headerrec.=" "; }
echo "
" . $headerrec . $detailrec . "
";
return null;
}
}
// End of business logic piecing together CSV report
return null;
}
}
$genextra="";
if (isset($_GET['generic']) || isset($_POST['generic'])) {
$genextra="";
}
$xmlstr="";
$outidea="outfile.csv";
$keep=true;
if (!isset($_GET['keep']) && !isset($_POST['keep'])) {
$keep=false;
}
if ($gxml != "") {
// add in file(spec) considerations here
if (strpos(str_replace("+"," ",urldecode($gxml)), " ") !== false || strpos(str_replace("+"," ",urldecode($gxml)), "*") !== false || strpos(str_replace("+"," ",urldecode($gxml)), "%") !== false || strpos(str_replace("+"," ",urldecode($gxml)), "?") !== false) {
$htmlis="