In the previous part we have generated the downloading url.
There are some technical facts. You have to download the video on the server to actually convert the videos into mp3.
Tempvids is the directory to store temporary flv videos before conversion
So here is the code which can be used to download the video file on your server.
$data = file_get_contents($download_link);
$gets=$_GET['vid'].'.mp3';
$new_flv_path = dirname(_FILE_).'/tempvids/'.$_GET['vid'].'.flv' ;
file_put_contents($new_flv_path, $data);
At last you must require ffmpeg to convert flv into mp3 and provide them to the user for download.
exec("ffmpeg -i tempvids/".$_GET['vid'].".flv -vn -acodec copy ".$_GET['vid'].".mp3");
Few Tips:
- The download of the video is a time consuming process so the speed of the script depends on your server's downloading/transfer rate.

