Hello
I googled for samples, but I'd like to make sure there's no simpler
way to parse tab-separated data read from a web page, before I can
save them into a database:
<?php
$input = file_get_conten ts ("http://server/data.php");
//item1<TAB>item2 <CRLF>
$contents = explode("\r\n", $input);
foreach ($contents as $row) {
$line = explode("\t",$r ow);
foreach($line as $col) {
//Here, will save each col into database
print $col;
}
}
?>
Thanks for any tip.
I googled for samples, but I'd like to make sure there's no simpler
way to parse tab-separated data read from a web page, before I can
save them into a database:
<?php
$input = file_get_conten ts ("http://server/data.php");
//item1<TAB>item2 <CRLF>
$contents = explode("\r\n", $input);
foreach ($contents as $row) {
$line = explode("\t",$r ow);
foreach($line as $col) {
//Here, will save each col into database
print $col;
}
}
?>
Thanks for any tip.
Comment