Hi David,
I am processing a tab delimited text file and in the demo area of your site it works perfectly.
If I copy the generated PHP script and upload it to my server, run the script I do not get any data displayed.
The code I am using is:
<?php
require("/var/www/vhosts/mydomain/httpdocs/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["FIELD1"];
}
$result = MagicParser_parse("/var/www/vhosts/mydomain/httpdocs/xml/LGW-ALL.TXT","myRecordHandler","csv|9|0|0");
?>
Do you have any idea why there is no result.
Many thanks for any help you can provide.
Best regards,
Dereck
Good morning David,
Many thanks for looking over the small script.
In the light on a new day I spotted the error in the script.
The file name was incorrect; it was LGW-ALL.TXT and should be LGW_ALL.TXT.
I am sorry for waisting your time, again many thanks.
Dereck
Hi Dereck,
All looks fine - it's a local file so it's not an HTTP issue - I would add the getErrorMessage call after your parse call which might reveal the problem...
$result = MagicParser_parse("/var/www/vhosts/mydomain/httpdocs/xml/LGW-ALL.TXT","myRecordHandler","csv|9|0|0");
print MagicParser_getErrorMessage();
Cheers,
David.