Hey David,
Just wanted to ask if it's possible to limit the number of records to process from a URL or File. For instance the feed contains 10,000 items but due to server constraints, I want magic parser to process only the first 6,000 items and exit.
Any help is appreciated.
Blaise
Hello Blaise,
No problem, Magic Parser will stop if you return TRUE from your myRecordHandler function; so all you need to do is maintain a global counter variable, and then return TRUE once you have processed as many records as you want. Consider the following (incomplete) example:
$counter = 0;
function myRecordHandler($record)
{
global $counter;
$counter++;
if ($counter == 10000) return TRUE;
// process $record as normal here...
}
Hope this helps!
Cheers,
David.