mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stex: use new url of stocksexchange
This commit is contained in:
parent
8ad60658e4
commit
685747b1b8
1 changed files with 8 additions and 8 deletions
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
// markets https://stocks.exchange/api2/markets
|
||||
// prices https://stocks.exchange/api2/ticker
|
||||
// prices https://stocks.exchange/api2/prices (unused)
|
||||
// markets https://app.stex.com/api2/markets
|
||||
// prices https://app.stex.com/api2/ticker
|
||||
|
||||
function stocksexchange_api_query($method)
|
||||
{
|
||||
$uri = "https://stocks.exchange/api2/$method";
|
||||
$uri = "https://app.stex.com/api2/$method";
|
||||
|
||||
$ch = curl_init($uri);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
@ -26,9 +25,10 @@ function stocksexchange_api_user($method, $params=array())
|
|||
|
||||
if (empty(EXCH_STOCKSEXCHANGE_KEY) || empty(EXCH_STOCKSEXCHANGE_SECRET)) return false;
|
||||
|
||||
$exchange = 'stocksexchange';
|
||||
$mt = explode(' ', microtime());
|
||||
$nonce = $mt[1].substr($mt[0], 2, 6);
|
||||
$url = "https://stocks.exchange/api2?method=$method&nonce=$nonce";
|
||||
$url = "https://app.stex.com/api2?method=$method&nonce=$nonce";
|
||||
|
||||
$sign_data = json_encode($params);
|
||||
$sign = hash_hmac('sha512', $sign_data, EXCH_STOCKSEXCHANGE_SECRET);
|
||||
|
@ -57,7 +57,7 @@ function stocksexchange_api_user($method, $params=array())
|
|||
$res = curl_exec($ch);
|
||||
if($res === false) {
|
||||
$e = curl_error($ch);
|
||||
debuglog("stocksexchange: $e");
|
||||
debuglog("$exchange: $e");
|
||||
curl_close($ch);
|
||||
return false;
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ function stocksexchange_api_user($method, $params=array())
|
|||
if(!is_object($result) && !is_array($result)) {
|
||||
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if (strpos($res,'Maintenance'))
|
||||
debuglog("stocksexchange: $method failed (Maintenance)");
|
||||
debuglog("$exchange: $method failed (Maintenance)");
|
||||
else
|
||||
debuglog("stocksexchange: $method failed ($status) ".strip_data($res));
|
||||
debuglog("$exchange: $method failed ($status) ".strip_data($res));
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
|
Loading…
Add table
Reference in a new issue