Hello-
I am trying to get the data contained in the last row from the following url/network location:
{link saved}
would like to be able to load/insert the data into a db table
example data from file:
201301021605 280 271 267 272 280 280 267 266 264 311
for some reason when attempting to use the demo on site it fails to load the data as well. could it be because of the ampersands in the url?
thanks so much for a great product!
Regards,
JP
Hi JP,
The file appears to be fixed width delimited which isn't a format supported by Magic Parser, however it would be straight forward to get the last line using basic string handling functions - have a go with something like:
<?php
$data = file_get_contents("{link saved}");
// trim to remove any blank lines at the end
$data = trim($data);
// explode to split into lines
$lines = explode("\n",$data);
// get last line using count()
$last_line = $lines[count($lines)-1];
// use preg_replace to change spaces into tab
$last_line = preg_replace('/[ ]{2,}/',"\t",$last_line);
// finally explode on tab to get individual fields
$fields = explode("\t",$last_line);
print_r($fields);
?>
(replace {link saved} with your source URL)
Hope this helps!
Cheers,
David
--
MagicParser.com