mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 09:27:25 +00:00
bitz: prevent api error if data field is not present
This commit is contained in:
parent
cc456814c5
commit
b6aa81390a
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,7 @@ function bitz_api_query($method, $params='', $returnType='object')
|
|||
$url = "https://apiv2.bitz.com/Market/$method/";
|
||||
if (!empty($params))
|
||||
$url .= "?$params";
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
|
@ -15,10 +16,12 @@ function bitz_api_query($method, $params='', $returnType='object')
|
|||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; BitZ API PHP client; '.php_uname('s').'; PHP/'.phpversion().')');
|
||||
curl_setopt($ch, CURLOPT_ENCODING , '');
|
||||
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$execResult = curl_exec($ch);
|
||||
if ($returnType == 'object')
|
||||
$ret = json_decode($execResult);
|
||||
else
|
||||
$ret = json_decode($execResult,true);
|
||||
return $ret->data;
|
||||
|
||||
return objSafeVal($ret,'data',array());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue