I have a component in my PHP code that send a POST request to another third part server. The problem is the other server is to slow and it take him a bit to return an answer. I want my code to continue, without waiting to an answer (async). Is there a way to do that?
This is my function:
function send_post_to_url($url,$post) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
$return = curl_exec($ch);
curl_close($ch);
return $return;
}
send_post_to_url("https://www.somesite.com",['action' => 'some_action']);
Thanks :)