我正在尝试使用PHP exec()
以JSON格式获取视频详细信息
我的CentOS服务器上安装了youtube-dl
。
通过youtube-dl -J <VideoURL>
/ SSH
运行Terminal
很好。
我的test.php
脚本返回空白页:(
echo exec("youtube-dl -J <VideoURL>");
//Installed via pip
//OR
echo exec("python /home/site/youtube-dl -J <VideoURL>");
//Downloaded as file named youtube-dl
如果我像这样测试,则启用 exec
:
if(function_exists('exec')) {
echo "exec is enabled";
}
服务器未 IP
被YouTube阻止,因为我能够通过终端成功运行命令