Answer the question
In order to leave comments, you need to log in
How to send a file to the browser for download?
There is a link to the video: https:
//api2.musical.ly/aweme/v1/playwm/ ?video_id
= ... I have the following file with this code:
<?php
if (isset($_GET['video']))
{
$ch = curl_init($_GET['video']);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1)
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=video.mp4");
echo $output;
die();
}
https://example.com/download.php?video=https://api2.musical.ly/aweme/v1/playwm/?video_id=v09044530000bqsiqd8lths38b053nrg
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question