Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

311
Views
PHP CURL response time bypass

I have an CURL request, where at times, and also depending on the request load, it takes minutes to receive response from the API, due to processing and calculations.

For sake of good user experience, this behavior is undesired to have. While waiting for response, sometimes long time, user is unable to perform any functions on the website.

So I am looking for solutions on how to go by doing it so the user can use the application while this application waits for results from API.

Solutions I have already considered.

  1. Recording the request and using cron job to process it. Unfortunately there is couple of pitfalls to that. -Need of running a cron job every minute or constantly. -Situations when user request is minimal or API is super fast at the moment, entire request may only take 2-3 seconds. But when using cron and it was requested let's say 30 seconds ahead of time for next cron job run, you end up with result of 32 second turn around. So this solution may improve some, and worsen some, not sure if I really like that.

  2. Aborting CURL request after few seconds. Although the API sends separate response to url endpoint of my choice, and it seems safe to terminate transmission after posting request, there might be situation when those few seconds may not be enough time to even establish the connection with API. I guess what I am trying to say is that, with terminating CURL I have no way of knowing if the actual request made it through.

Is there another approach that I could consider? Thank you.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Sounds like what you're asking for is an asynchronous cURL call.

Here's the curl_multi_init documentation

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!