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

puvanarajan's avatar

Job queue curl not working

I am using laravel job and when job triggered need to execute the curl. If I used the queue:work then curl is not working. But If I use the queue:listen then curl is working. Anyone know the solution for this?

This is my CURL code

$curl = curl_init();

    curl_setopt($curl,CURLOPT_URL, 'www.google.lk');
    curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl,CURLOPT_ENCODING, "");
    curl_setopt($curl,CURLOPT_MAXREDIRS, 10);
    curl_setopt($curl,CURLOPT_TIMEOUT, 0);
    curl_setopt($curl,CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl,CURLOPT_CUSTOMREQUEST,  'GET');
    curl_setopt($curl, CURLOPT_HTTPHEADER, []);
    curl_setopt($curl, CURLOPT_COOKIEFILE, "-");
    var_dump(curl_exec($curl));
0 likes
2 replies
bobbybouwmann's avatar

What exactly are you doing in your job?

queue:listen and queue:work mostly have the same working, however queue:listen is an on going process while queue:work only runs one job at the time. queue:work also only works if you have something in your queue which hasn't run yet!

puvanarajan's avatar

This is my curl code

$curl = curl_init(); curl_setopt($curl,CURLOPT_URL, 'www.google.lk'); curl_setopt($curl,CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLOPT_ENCODING, ""); curl_setopt($curl,CURLOPT_MAXREDIRS, 10); curl_setopt($curl,CURLOPT_TIMEOUT, 0);

    curl_setopt($curl,CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl,CURLOPT_CUSTOMREQUEST,  'GET');
    curl_setopt($curl, CURLOPT_HTTPHEADER, []);
    curl_setopt($curl, CURLOPT_COOKIEFILE, "-");

    var_dump(curl_exec($curl));

Please or to participate in this conversation.