The code is https://www.livecoin.net/api/examples#vb
I tried to add closing bracket at netbean and I got a warning unnecessary closing bracket. What am I missing?
<?php
$url = "https://api.livecoin.net/exchange/buylimit";
$apiKey = "gJx7Wa7qXkPtmTAaK3ADCtr6m5rCYYMy";
$secretKey = "8eLps29wsXszNyEhOl9w8dxsOsM2lTzg";
$params = array(
'currencyPair'=> 'BTC/USD',
'price'=> 60,
'quantity'=>1
);
ksort($params);
$postFields = http_build_query($params, '', '&');
$signature = strtoupper(hash_hmac('sha256', $postFields, $secretKey));
$headers = array(
"Api-Key: $apiKey",
"Sign: $signature"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($statusCode!=200) {
//dump info:
echo "Status code: $statusCode, response: $response";
//throw new Exception('Can not execute the query!');
}
var_dump(json_decode($response));