I have created a sequence of curl request. I have created a controller to put the requests in a queue with the data received from user.
Here is my controller to make queue:
class FooController extends Controller
{
public function index()
{
$result = CurlProcessJob::dispatch(\request()->all())
->delay(now()->addSeconds(5));
if($result)
if($httpCode ===200)
//rest of code
And CurlProcessJob , in the handle function
public function handle($request)
{
$curl = curl_init($request['ip']);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'data =' . json_encode($request['introduce']));
curl_setopt($curl, CURLOPT_POST, 1);
$result = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
}
the problem is how can i access $resultand $httpCode variables in controller.
another problem is since the queue has 5 second delay,how the rest of code executed. I men the rest of code don't wait for execution of job
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire