Patrick Duke Schauer
Patrick Duke Schauer

Reputation: 91

Read json data from url into variables

This worked perfect for all Currencies. I can output all data with '0','1','2',...

$url = 'https://bittrex.com/api/v1.1/public/getmarketsummaries
$response = file_get_contents($url);
$obj = json_decode($response,true);

$marketname = $obj['result'][0]['MarketName'] . '';

And this url is for a single currency with the 'market' string.

https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-neo

But how can i read this?

$url = 'https://bittrex.com/api/v1.1/public/getmarketsummaries?market=btc-neo
$response = file_get_contents($url);
$obj = json_decode($response,true);

$marketname = $obj['result'][0]['MarketName'] . '';

doesn't work!

Any idea?

Upvotes: 0

Views: 58

Answers (2)

Indent
Indent

Reputation: 4967

from API

Use singular summary instead of summaries to filter on market

$url = 'https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-neo'

Upvotes: 1

Patrick Duke Schauer
Patrick Duke Schauer

Reputation: 91

HAVE IT:

Instead:

$url = 'https://bittrex.com/api/v1.1/public/getmarketsummaries?market=btc-neo';

This:

$url = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-neo";

The key was also " instead of '

Thanks to all!

Upvotes: 0

Related Questions