You are here:  » Cannot understand which format string


Cannot understand which format string

Submitted by baldisserri on Mon, 2010-03-08 23:07 in

Hello,
I cannot understand how to parse this:

{link saved}

Is possible? Thanks

Submitted by support on Tue, 2010-03-09 08:47

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:

<?php
  
require("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.