我正在实现一个 YouTube 下载器,它将视频从这里存储到服务器上。我已经修改了在服务器而不是计算机上下载 YouTube 视频的代码。这是我的 download.php 代码:
include_once('config.php');
// Check download token
if (empty($_GET['mime']) OR empty($_GET['token']))
{
exit('Invalid download token 8{');
}
// Set operation params
$mime = filter_var($_GET['mime']);
$ext = str_replace(array('/', 'x-'), '', strstr($mime, '/'));
$url = base64_decode(filter_var($_GET['token']));
$name = urldecode($_GET['title']). '.' .$ext;
// Fetch and serve
if ($url)
{
$size=get_size($url);
$file_path ="localhost/video/";
$download_video_file = file_put_contents($file_path, fopen($url, 'r'));
exit;
}
// Not found
exit('File not found 8{');
它给了我一个错误(警告)
Warning: file_put_contents(localhost/video/): failed to open stream: No such file or directory in C:\wamp\www\Yoyo\download.php on line 43
我验证是否存在 localhost/video。我还删除了本地主机:
$file_path ="/video/";
并检查它,但它仍然抛出相同的警告。问题是什么?