PHP Classes
elePHPant
Icontem

problem in url returned

Recommend this page to a friend!

      PHP Youtube and Vimeo Video Downloader Script  >  All threads  >  problem in url returned  >  (Un) Subscribe thread alerts  
Subject:problem in url returned
Summary:the download attribute on the url is not working
Messages:4
Author:naveen
Date:2017-01-20 17:29:47
 

  1. problem in url returned   Reply   Report abuse  
naveen - 2017-01-20 17:29:47
i have make a link like <a href="$videourl" download>download</a> button like this, but instead of downloading the browser opens in a new player

  2. Re: problem in url returned   Reply   Report abuse  
Ssaurz Acharya - 2017-01-20 23:48:24 - In reply to message 1 from naveen
Hi,
This is the script that returns the raw link of videos. To download a video you have to use header() to make a force file download.

  3. Re: problem in url returned   Reply   Report abuse  
naveen - 2017-01-21 01:14:30 - In reply to message 2 from Ssaurz Acharya
can you give me a example please?

  4. Re: problem in url returned   Reply   Report abuse  
Ssaurz Acharya - 2017-01-23 12:43:09 - In reply to message 3 from naveen
Hi, this is simple the example
function downloadVideo($video_file_url, $extension, $title)
{
$header_info = get_headers($video_file_url, 1);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$title.'.'.$extension.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . $header_info["Content-Length"]);
readfile($video_file_url);
}