",$tmp);
if ($tmp2 === false) { return false; }
$row = substr($rawHTML,$tmp,$tmp2-$tmp);
$pattern = "/| | | | | ",$tmp);
if ($tmp === false) { return false; }
$tmp++;
$tmp2 = strpos(strtoupper($row),"",$idx)+5;
$rowIdx++;
/* Now parse the rest of the rows. */
$tmp = strpos($upperHTML," | ",$idx);
if ($tmp2 === false) { return false; }
$table = substr($rawHTML,$tmp,$tmp2-$tmp);
while ($tmp = strpos(strtoupper($table),"
",$tmp);
if ($tmp === false) { return false; }
$tmp++;
$tmp2 = strpos(strtoupper($row),"")+5);
$rowIdx++;
}
return $aryData;
}
/*
Static method table_into_xml()
Generic function to return xml dataset from HTML table data
rawHTML: the page source
needle: optional string to start parsing source from
allowedTags: list of tags to NOT strip from data, e.g. ""
*/
function table_into_xml($rawHTML,$needle="",$needle_within=0,$allowedTags="") {
if (!$aryTable = http::table_into_array($rawHTML,$needle,$needle_within,$allowedTags)) { return false; }
$xml = "\n";
$xml .= "\n";
$rowIdx = 0;
foreach ($aryTable as $row) {
$xml .= "\t\n";
$colIdx = 0;
foreach ($row as $col) {
$xml .= "\t\t".trim(utf8_encode(htmlspecialchars($col)))."\n";
$colIdx++;
}
$xml .= "\t
\n";
$rowIdx++;
}
$xml .= "
";
return $xml;
}
}
?>