You are here:  » folding at home stats?


folding at home stats?

Submitted by Sniper on Mon, 2006-08-14 20:15 in

Is it possible to parse http://vspx27.stanford.edu/teamstats/team34583.txt ?

thanks

Submitted by support on Mon, 2006-08-14 21:56

Hi There,

It is possible, but requires an undocumented feature of Magic Parser that enables you to skip over the first n lines of pre-amble.

Disregarding the first 7 lines of text, the data is tab separated values, and therefore you can use the Magic Parser format string "csv|09|0|0|7", which means text format, tab separated, no header row, non-quoted values, skip 7 rows of text at the start of the file.

You can see this on the demo tool using the following URL:

http://www.magicparser.com/demo?formatString=csv|09|0|0|11&fileID=44E0ED4E13CAF&record=1

Extending the example source code created using the above demo link, you can parse the data from that file into a table....

TeamSats Demo

Here's the source code to that demo:

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($record)
  {
    print 
"<tr>";
    print 
"<td>".$record["FIELD1"]."</td>";
    print 
"<td>".$record["FIELD2"]."</td>";
    print 
"<td>".$record["FIELD3"]."</td>";
    print 
"<td>".$record["FIELD4"]."</td>";
    print 
"<td>".$record["FIELD5"]."</td>";
    print 
"<td>".$record["FIELD6"]."</td>";
    print 
"</tr>";
  }
  print 
"<table border='1'>";
  print 
"<tr>";
  print 
"<th>Rank</th>";
  print 
"<th>Team Rank</th>";
  print 
"<th>Name</th>";
  print 
"<th>Credit</th>";
  print 
"<th>Total</th>";
  print 
"<th>Team</th>";
  print 
"</tr>";
  
MagicParser_parse("http://vspx27.stanford.edu/teamstats/team34583.txt","myRecordHandler","csv|09|0|0|7");
  print 
"</table>";
?>

Hope this helps!
Cheers,
David.