So i am trying to use fopen to call a file from my server that gets auto dowloaded everyday with the same partial title the same every time but only want to get the file for today. for example if the file is file20160310.csv i can get it with $file = fopen('file'. $today . '.csv', 'r') or die('cant open file'); where $today = date("m-d-y");
(but the file name is file20160310875647.csv and the digits after the date are random) is there a way to stip these numbers from the title when i do fopen ( i cannot change the file it is lock)
Solution
Solution--so both answers below worked but i used the answer from T0xicCode for the inclusion of .$today. in the answer and egg answer for the help with fgetcsv
$list = glob('ShipToUsShipments'. $today . '*.csv');
$filename = $list[0];
$file = fopen($filename, 'r') or die('cant open file');
fetcsv($file,1000,",");
($line = fgetcsv(fopen($file))) { echo $line[0]; }