0

What PHP code will embed the video with below conditions?

My OneDrive video original download link creates an unique token based link for each viewers on my webpage. Normally to embed the video on my webpage, I directly write my original video link. But I want a PHP code which will embed the video with token link so when a person open source code of my webpage they will see the token based link not my original link. Let me clarify more; A person click the watch now button. He gets redirected to the webpage where I have embedded the video. PHP code should run the downlad video link in backend. The downlad link automatically creates unique link so we don't need any code to have token based link. Now Auto generated token based downlad link should be embedded on my webpage. So if a person tries to copy it then that link will be useless.

14th May 2020, 8:05 AM
Ashish Sah
Ashish Sah - avatar
1 Respuesta
+ 1
We recently had to solve this problem. First we sent the file stream via ajax request and then download the file via HTML5 file API, but it caused a lot of problems for files > 5MB. The solution that we implemented at the end, and sounds best is to create a temporary file URL with some temporary token, for that file to be downloaded. With an expiration like 5 minutes or whatever suits your need. On your API call send that new URL and open in new tab or download or any other thing you want to do. The best way to do this is to mask url. user logins generate a token based on his login details. some md5 or whatever you decide create a download link (eg: download.php) that load the file based on valid token and session and get's the file with file_get_contents(). Also, have a look at this 👇 "One Time Temporary Download Link with Expiration in PHP- SemicolonWorld" https://www.semicolonworld.com/tutorial/one-time-temporary-download-link-with-expiration-in-php
14th Jul 2020, 12:06 PM
Akshay_U
Akshay_U - avatar