Bitte um hilfe bei Apiabfrage

klausi89

Erfahrenes Mitglied
Hallo ich habe mal wieder ein problem

ich möchte gerne per api eine Abfrage machen...der Anbieter gibt folgendes an......

https://example.com/api/v1/balance

Parameters
  • api_key - our API key from Dashboard
  • currency - (optional) API name of selected currency (ex. "BTC", "LTC"). You can check API name for currency on Dashboard. It defaults to "BTC" if not present.
Response fields
  • balance - Your balance for this currency in satoshi.
  • balance_bitcoin - Your balance for this currency in coins (the same as balance divided by 10^8)
Example request
PHP:
api_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&currency=xpm
Example response

Code:
{
    "status":200,
    "balance":77519999889,
    "balance_bitcoin":"775.19999889"
}

ich habe mir nun folgendes dazu gemacht -->

Code:
$urlbase = "https://example.com/api/v1/balance";
$api_key ='XXXXXWERTGZHVDTFDSEDFCGWWWXXX'; <-- example
$currency ='xpm';
$balance = file_get_contents($urlbase.'/api_key='.$api_key.'&currency='.$currency);

aber irgendwie gibt er mir ständig an

{"status":403,"message":"Invalid API key."}

aber mein Api Key ist definitiv richtig, muss man das vielleicht anders abfragen ?

Eventuell hat jemand ne Idee dazu, danke schonmal.

 
Zurück