'Download & Save Zoom Recording in directory by PHP

Some time ago this code was working fine. I was able to download a file into a directory by using a copy command but it stopped working. It is no longer downloading a file. It always creates a 0-byte file.

The code I'm using:

$video_url = 'https://api.zoom.us/rec/download/tJN4d7v5_Ts3HtzD4QSDVqJwW9XoJvms0nUbq_cPnRzhUCMAN1alZrVAN-AD8vw4clXzSccEqqZtfZw_';
$local_file = getcwd() ."/tmp/tmp_file.mp4";
copy($video_url, $local_file);

I have tried various ways to download and save but nothing helps.



Solution 1:[1]

Your $video_url returns 302 http response. Try this

$src = 'https://api.zoom.us/rec/download/tJN4d7v5_Ts3HtzD4QSDVqJwW9XoJvms0nUbq_cPnRzhUCMAN1alZrVAN-AD8vw4clXzSccEqqZtfZw_';
$fileName = 'tmp_file.mp4';
$dest = getcwd() . DIRECTORY_SEPARATOR . $fileName;
$ch = curl_init($src);
curl_exec($ch);
if (!curl_errno($ch)) {
    $info = curl_getinfo($ch);
    $downloadLink = $info['redirect_url'];
}
curl_close($ch);

if($downloadLink) {
    copy($downloadLink, $dest);
}

Solution 2:[2]

You have to pass the access token in order to download the video recordings

here is the line you will update to pass the access token curl_setopt($ch,CURLOPT_URL,download_URL?access_token)

As only host is allowed to record and download the meetings. By passing access token you will allow to download the meetings for every user.

Access token is the token you would be generating from JWT.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ?????? ??????????
Solution 2