首页 > 解决方案 > Laravel Queue 使用 CURL 下载文件

问题描述

我正在尝试使用 curl 生成文件。当我尝试通过终端执行命令时,它工作正常。

在此处输入图像描述

但是当我尝试使用队列在 laravel 上实现它时,脚本运行但下载的文件已损坏。

在此处输入图像描述

正如您从“花费的时间”中看到的那样,与从终端执行的相比,它甚至没有价值。该文件在那里,但显然已损坏,因为 laravel 甚至在它开始之前就已经完成了命令。

这是我关于handle()GeneratBukuVot Job 功能的代码:

$path = Storage::path('public/test.pdf');

$pentaho =  'http://192.168.0.17:8080/pentaho/api/repos/:home:admin:anggaran_hasil_and_belanja_param.prpt/generatedContent?output-target=pageable/pdf&search_year=2019';
    $cmd = 'curl -u"admin:password" "'.$pentaho.'" -o "'.$path.'"';
    $output = shell_exec($cmd);

我正在使用 Laravel 5.8 版。请帮忙。

标签: phplaravelcurlpentaholaravel-queue

解决方案


推荐阅读