Ignore cURL response?

I have a login script that passes data to another script for processing. The processing is not related to the script login, but it performs data validation and logging for internal analysis.

I use cURL to pass this data, but cURL is waiting for a response. I do not want to wait for an answer, because it makes the user wait until the analysis is completed before they can log in.

I know that the request may fail, but I'm not too worried.

Basically, I want it to work as a multi-threaded application where cURL is used to fork the process. Is there any way to do this?

My code is below:

// Log user in

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://site.com/userdata.php?e=' . $email);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$html = curl_exec($ch);
curl_close($ch);

// Redirect user to their home page

That's all. But for now, he has to wait for the cURL request to get a response.

Is there a way to make a request for a receipt and not wait for a response?

+3
4

. HTTP-, . , , .

. .

, "" async/forking, .

+4

, , , ) (CURLOPT_NOBODY), ( ) ) , , , HEADing

+2

: , -, , ? cron, script, , cron, script . , , , script, , .

0

, , , - . . , beanstalkd pheanstalk PHP. (, ), cron, .

URL- "". , , .

You do not need exec to complete the processing - run the CLI script in an infinite loop that requests the jobs from the queue and processes them.

You can also watch ZeroMQ .

In general, this is no different from what GZipp offers, simply using a system specifically designed for this mode of operation.

If you have a restrictive provider that prevents you from running other software, it may be time to find a new provider - Amazon AWS will provide you with a free copy of EC2 for a year.

0
source

Source: https://habr.com/ru/post/1783113/


All Articles