title: How to download a video or audio file from any remote url using php?
body: <p>I want to download a video / audio file form remote url using php. I had tried the below 
  code its work fine. But it takes time to download. How to download in fastest way. And also i want to get the downloaded file size and duration of file. Please help me how to do this.</p>
  
  <p>My code here:</p>
  
  <pre><code>&lt;?php
  $remote_url = ; // Any remote url with direct file path
  $content = get_headers($remote_url,1);
  $content = array_change_key_case($content, CASE_LOWER);
  if ($content['content-disposition']) {
  $tmp_name = explode('=', $content['content-disposition']);
  if ($tmp_name[1]) 
  $realfilename = trim($tmp_name[1],'";\'');
  } else  
  {
  $stripped_url = preg_replace('/\\?.*/', '', $remote_url);
  $realfilename = basename($stripped_url);
  } 
  $remote_file_contents = file_get_contents($remote_url );
  $local_file_path = $realfilename.'';
  $song_copied = file_put_contents($local_file_path, $remote_file_contents);
  ?&gt;
  </code></pre>
  
  <p>Thanks &amp; Regards.</p>