I am writing a function which download Zoom Meeting Recording (mp4 file). Using file_get_contents($url) and file_put_contents to save the file, it was throwing error - 403 forbidden.
But when I do it using axios, it download and saves the file properly. Here is the working code -
axios({
method: "GET",
url: url,
responseType: "stream"
}).then(function (response) {
response.data.pipe(fs.createWriteStream("test.mp4"));
})
I tried copy(), file_get_contents(), fopen() and also tried setting context and ini following answers to this question but all returning forbidden though the same URL works in axios.