exchanges: add missing timeout curl options

This commit is contained in:
Tanguy Pruvot 2017-07-18 01:00:45 +02:00
parent fe4dc4e25a
commit 3489940168
7 changed files with 14 additions and 5 deletions

View file

@ -9,6 +9,7 @@ function alcurex_api_query($method, $params='')
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$execResult = strip_tags(curl_exec($ch));
$obj = json_decode($execResult);

View file

@ -9,6 +9,8 @@ function bitstamp_api_query($method, $params='')
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$execResult = curl_exec($ch);
$res = json_decode($execResult, true);
@ -51,6 +53,7 @@ function bitstamp_api_user($method, $params='')
//curl_setopt($ch, CURLOPT_SSLVERSION, 1 /*CURL_SSLVERSION_TLSv1*/);
curl_setopt($ch, CURLOPT_SSL_SESSIONID_CACHE, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; Bitstamp API PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
curl_setopt($ch, CURLOPT_ENCODING , '');

View file

@ -10,6 +10,8 @@ function bter_api_query($method, $params='')
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$data = strip_tags(curl_exec($ch));
if ($method == 'tickers' && empty($params)) {

View file

@ -12,6 +12,8 @@ function cryptopia_api_query($method, $params='')
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$execResult = curl_exec($ch);
$obj = json_decode($execResult);

View file

@ -8,14 +8,10 @@ function jubi_api_query($method, $params)
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$execResult = curl_exec($ch);
$obj = json_decode($execResult);
return $obj;
}

View file

@ -12,6 +12,7 @@ function shapeshift_api_query($method, $params='')
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
@ -39,6 +40,7 @@ function shapeshift_api_post($method, $data=array())
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);

View file

@ -6,6 +6,8 @@ function yobit_api_query($method)
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$execResult = curl_exec($ch);
$obj = json_decode($execResult);
@ -52,6 +54,7 @@ function yobit_api_query2($method, $req = array())
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; SMART_API PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
curl_setopt($ch, CURLOPT_URL, 'https://yobit.net/tapi/');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);