Thanks for sharing this.


Regarding your second point, have you tried replacing “\r\n” with the constant PHP_EOL?  That is:


fputs($file, implode(PHP_EOL, $harvestedIds));


PHP_EOL should be set to “\n” under Linux and “\r\n” under Windows, so it might be the most platform-independent way of solving this problem.  If it works for you under Windows, please let me know and I’ll double-check it under Linux.  If it works in both places, I can commit the change to the trunk so the tool will work for everyone in the future.


I’m a little wary of adding the utf8_encode() fix to the trunk, though – this sounds like it may be more of a local workaround than a standard solution and might have some negative side effects on strings that aren’t ISO-8859-1 encoded.  Perhaps it could be added as another .ini setting, though.


- Demian


From: Denman, Jamie []
Sent: Wednesday, August 31, 2011 11:03 AM
Subject: [VuFind-General] OAI Harvesting


Hi List

I have found a couple of changes that I needed in the “harvest_oai.php” script in order to harvest records onto our Windows 2008 VuFind server:

·         Added “$response = utf8_encode($response);” to the _sendRequest() function – this prevented the script from crashing out when it calls  simplexml_load_string($xml); in the _processResponse() function (some of our older records are not UTF8 encoded)

·         Added a “\r” to the line fputs($file, implode("\r\n", $harvestedIds)); in the _processRecords() function as all the IDs need to be on a separate line if you want to use the log file to delete imported records – not sure why the “\n” didn’t do this on its own.


Just in case anyone else spends days trying to harvest records and comes across problems with certain sets.






Jamie Denman

Library Assistant (Systems), Tremough Library


University College Falmouth

Tremough, Penryn, Cornwall TR10 9EZ


01326 254178



This email is confidential and intended solely for the use of the intended recipient only. If you have received this email in error, please inform us immediately and then delete it. Unless it specifically states otherwise this email does not form part of a contract.

Any views or opinions presented are solely those of the author and do not necessarily represent those of University College Falmouth. You should carry out your own virus check before opening any attachment. University College Falmouth accepts no liability for any loss or damage which may be caused by software viruses