-1

I have a function which makes an curl request, and it take a many time in every call between 5 to 30 sec depending on the connection , how i can use A sync instead on the curl in laravel 8??

  • Does this answer your question? [Async curl request in PHP](https://stackoverflow.com/questions/36171222/async-curl-request-in-php) – DaCurse Mar 25 '22 at 21:48

1 Answers1

1

This can be achieved using Laravel Queue: https://laravel.com/docs/9.x/queues

aceraven777
  • 4,358
  • 3
  • 31
  • 55
  • I don't want use queue ,, i want to make call to api with out wait the response like curl ,, just make a call and dont wait the response go to the next process don't stop the script – Tarek Ramadan Mar 25 '22 at 05:19
  • That's exactly the purpose of Queue, performing asynchronous tasks. Create a job, put your curl script there. Then on your controller dispatch that job, e.g. `ThisIsJob::dispatch();`. It will run that job asynchronously. – aceraven777 Mar 25 '22 at 06:01
  • queue work job by job and in my project can send more thane 30 request in the mint ,, i'm working in integration between mobile app and 20 stores ,, i'm using curl in php native but the problem if store want to close 10 product in the same time the request maybe take 3 : 5 min – Tarek Ramadan Mar 26 '22 at 22:25
  • i want to make request if the user make the product unavailable make a change in local db and don't wait the curl – Tarek Ramadan Mar 26 '22 at 22:26