When using URL as a filename, such as "http://..." or "php://stdin", and also have the fopen wappers on, and you get a 'RuntimeException' error, try using "NoRewindIterator" class to a SplFileObject instance.
<?php
$url = 'http://sample.com/data.csv';
$file = new NoRewindIterator( new SplFileObject( $url ) );
foreach ($file as $line_num => $line) {
echo "Line $line_num is $line";
}
?>
While opening a file, a rewind method will be called, but these URL iterators cannot be rewind, so you'll get a "Fatal error: Uncaught exception 'RuntimeException' with message 'Cannot rewind file ...'" error.