At first I was getting line ending bugs, which is why I thought the "t" flag in `fopen()` might be necessary, and there wasn't any way that I could see to pass that through `file_put_contents()`. 

I don't think "t" is actually doing anything here though, the bug I was getting was unrelated; caused by trying to trim content and messing up the trailing whitespace. I'll use `file_put_contents()`/`file_get_contents()`.