How can i force curl to stop reading from my endpoint if the request is taking longer than 200 milliseconds, For example i am using the below curl get request.
$curl = curl_init('http://example.com');
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($curl);
echo $result;
I know this is possible using fsockopen and feof but i do not believe i can use fsockopen/feof because i bind my curl request to a specific interface / ip address using CURLOPT_INTERFACE
If this is not possible with curl, could someone please suggest an alternative solution for PHP where i can bind to the interface/ip and stop reading from the endpoint if 200ms is exceeded.