quandl anonymous user limit exceeded
I'm getting the following error out of my php script when executed from my Digital Ocean Droplet
Error - QELx01 : You have exceeded the anonymous user limit of 50 calls per day. To make more calls today, please register for a free Quandl account and then include your API key with your requests.
However the call works fine when ran from local host.
I am using the api_key allocated by quandl
here is the my code snippet:
// Silver
// Get newest date
$api_key = "SBPYxUYb_hz32nKxtqGU";
$params = new \stdClass();
$params->start_date = "2018-08-14";
$params->end_date = "2018-08-14";
$params->access_key = $api_key;
$json = CallAPI('GET', 'https://www.quandl.com/api/v3/datasets/LBMA/SILVER', $params , false);
echo($json);
$silver_data = json_decode($json, TRUE);
// Gte Current Price
$params->start_date = $silver_data["dataset"]["newest_available_date"];
$params->end_date = $silver_data["dataset"]["newest_available_date"];
$params->access_key = $api_key;
$json = CallAPI('GET', 'https://www.quandl.com/api/v3/datasets/LBMA/SILVER', $params , false);
$silver_data = json_decode($json, TRUE);
$silver_aud = $silver_data["dataset"]["data"][0][1] / $usdaud;
function CallAPI($method, $url, $data = false, $key = false)
// method: html request method
// url: the web address
// data: dat to append to url
// key: the access key to the web site
{
$curl = curl_init();
switch ($method)
{
case 'POST':
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case 'PUT':
curl_setopt($curl, CURLOPT_PUT, 1);
break;
default:
if ($data)
{
$info = http_build_query($data);
$url = sprintf('%s?%s', $url, $info);
}
}
if ($key)
{
$key_header = array('content-type: application/x-www-form-urlencoded', 'x-api-key: ' . $key);
curl_setopt($curl, CURLOPT_HTTPHEADER, $key_header);
}
// Optional Authentication:
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, '');
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
{
echo "curl Error :" . $err;
}
return $result;
}