You are here:  » How to read cvs feeds

Support Forum



How to read cvs feeds

Submitted by wouter on Fri, 2007-12-14 12:13 in

Hi,

On the demo page i see that magicparse also can read CVS feeds. I have enterd my feed for testing in the demo but it doesn't work... But i'm now not sure if magicparse can read my cvs feed.

{link saved}

Also on the manual pages i can't find how i can read cvs feeds...

Will you let me know if magicparse can read cvs feeds and wahere i can find a example ?

Thanks Wouter

Submitted by support on Fri, 2007-12-14 13:39

Hello Wouter,

That feed is semi-colon separated, which is the only format that is not auto-detected.

You can make it work with the demo; use Option 2, then on the second page, select the following Format String from the drop-down box:

Quoted Text - Header Row - Semi-Colon Separated

Then, use the "Generate PHP Source" to see the example Magic Parser code for this file, which is:

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($record)
  {
    
// This is where you write your code to process each record, such as loading a database
    // You can display the record contents using PHP's internal print_r() function:
    
print_r($record);
    
// The following code will print out each field in your sample data:
    
print $record["id"];
    print 
$record["title"];
    print 
$record["link"];
    print 
$record["description"];
    print 
$record["catalogid"];
    print 
$record["cname"];
    print 
$record["cdescription"];
    print 
$record["cprice"];
    print 
$record["weight"];
    print 
$record["mfg"];
    print 
$record["pother1"];
    print 
$record["pother2"];
    print 
$record["pother3"];
    print 
$record["cdateavailable"];
    print 
$record["pother4"];
    print 
$record["pother5"];
    print 
$record["extendedimage"];
    print 
$record["level3"];
    print 
$record["level4"];
    print 
$record["ccategory"];
    print 
$record["subcategoryid"];
    print 
$record["daisycon_unique_id"];
    print 
$record[""];
  }
  
MagicParser_parse("{link saved}","myRecordHandler","csv|59|1|34");
?>

Cheers,
David.