google oauth2 - YouTube resumable upload file from another server using php -


i using following php sample code upload videos youtube: https://developers.google.com/youtube/v3/code_samples/php#resumable_uploads

however, need possibility upload file stored in server. instance, path video in example above

$videopath = "/path/to/file.mp4"; 

to replace similar

$videopath = "http://142.4.1.45/myvideos/tutorials/video_1.mp4"; 

is possible? tried doing it, timeout error.

you can use curl write video file in server, use path upload youtube.

$ch = curl_init('http://142.4.1.45/myvideos/tutorials/video_1.mp4'); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer,1); raw = curl_exec($ch); curl_close ($ch);  $videopath = '/tmp/video_1.mp4'; $fp = fopen($videopath, 'x'); fwrite($fp, $raw); fclose($fp); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -