Cannot understand which format string
Submitted by baldisserri on Mon, 2010-03-08 23:07.Magic Parser
Hello,
I cannot understand how to parse this:
{link saved}
Is possible? Thanks
Support forum loginActive forum topics©2006-2010 IAAI Software |
Cannot understand which format stringSubmitted by baldisserri on Mon, 2010-03-08 23:07.Magic Parser
Hello, {link saved} Is possible? Thanks |
Hi There,
That file isn't really either a regular CSV or XML file; however having just had a quick look I think it can be quite easily manipulated using PHP's string functions to turn it into a regular CSV file (pipe separated, no header row, unquoted text), so the Format String would then be csv|124|0|0
Try something like this:
<?phprequire("MagicParser.php");
function myRecordHandler($record)
{
print_r($record);
return TRUE; // stop after first record for testing purposes
}
$url = "{link saved}";
$csv = file_get_contents($url);
$csv = str_replace("\n"," ",$csv);
$csv = str_replace("<endrecord>","\n",$csv);
MagicParser_parse("string://".$csv,"myRecordHandler","csv|124|0|0");
?>
(don't forget to replace {link saved} with your feed URL)
Hope this helps!
Cheers,
David.