Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

IkouKuhn's avatar

Laravel Queue download file using CURL

I'm trying to generate the file using curl. When I try executing the command via terminal it works fine. But when I try to implement it on laravel using a queue, the script runs but the downloaded file is corrupt.

As you can see from the "Time Spent" it doesn't even have value compared to the one executed from terminal. And the file is there but obviously corrupt since laravel already finished the command even before it started.

Here's my code on the handle() function of 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);

I'm using Laravel version 5.8. Please, help.

0 likes
0 replies

Please or to participate in this conversation.