add timeouts

master
Marek Isalski 7 years ago
parent a551261090
commit 2c7b3ddcbe

@ -133,6 +133,12 @@ function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null
curl_setopt( $curl, CURLOPT_HTTPHEADER, $request_headers ); curl_setopt( $curl, CURLOPT_HTTPHEADER, $request_headers );
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, true ); curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, true );
curl_setopt( $curl, CURLOPT_TCP_NODELAY, true ); curl_setopt( $curl, CURLOPT_TCP_NODELAY, true );
try {
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 2 );
curl_setopt( $curl, CURLOPT_TIMEOUT, 10 );
} catch ( Exception $e ) {
// do nothing
}
$result = curl_exec( $curl ); $result = curl_exec( $curl );
$response = curl_getinfo( $curl ); $response = curl_getinfo( $curl );

Loading…
Cancel
Save