Then you've identified that the file_put_contents works however retrieving the contents through file_get_contents($L) doesnt read the file.
try this to make sure your getting something;
The other issue could be that your trying to test 1 line: this isnt an array and you should see a message saying something like foreach supplied invalid array or something like it so make sure you enter on the end of your url if you are testing just 1 path.