- fclose: documentation ( source)
- fwrite: documentation ( source)
- fopen: documentation ( source)
<?php
function downloadFile($filename){
$Url = "http://tvfhls-a.akamaihd.net/1440927936/hls/1536/$filename";
echo "Downloading " . $Url . "\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$out = curl_exec($ch);
curl_close($ch);
$fp = fopen($filename, 'w');
fwrite($fp, $out);
fclose($fp);
}
$filename = "Pitchers_EP5_v3_5mbps.m3u8";
downloadFile($filename);
for($i=0; $i < 1698; $i ++ ) {
$filename = "Pitchers_EP5_v3_5mbps$i.ts";
downloadFile($filename);
}
?>