Setting "--keepalive-time" for curl in php

Solution:
If you are using PHP 5.5 or greater (currently 5.5, 5.6, & 7) built with cURL 7.25.0 or greater, you can set these cURL options in PHP to match the--keepalive-time
parameter (PHP <= 5.4 did not have these cURL options available):
curl_setopt($session, CURLOPT_TCP_KEEPALIVE, 1);
curl_setopt($session, CURLOPT_TCP_KEEPIDLE, 30);
curl_setopt($session, CURLOPT_TCP_KEEPINTVL, 15);
TheCURLOPT_TCP_KEEPIDLE
constant in libcurl corresponds to the--keepalive-time
command line option forcurl
.
See the cURL docs regarding CURLOPT_TCP_KEEPALIVE, CURLOPT_TCP_KEEPIDLE, and CURLOPT_TCP_KEEPINTVL for more info.
Note: These options are not available and can't be used if you have PHP 5.4 or lower.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: using $this when not in object context laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.