How to use Get/streams and 'channel'parameter?

Hello, everyone.

I don’t know how to print out β€˜/stremas?channel=user1,user2’.

For example, /streams/channel
I did usually coding to get value from several channels.

<? foreach($channels as $channel) { ?>
<span><? echo $streamer->stream->channel->display_name;?></span>		
<? }?>

But, It increase api requests. :frowning:

so I want to use β€˜/stremas?channel=user1,user2’.

How can I get output?
I tried such as,
<? echo $streamer->streams->channel->display_name;?>
but, output : 'Trying to get property of non-object ’

Please give me some examples.

Sorry for my english, I’m a french.

In the response of /streams?channel=user1,user2, the streams property is an array, so you need to iterate over it.

foreach ($data->streams as $stream)
    echo $stream->channel->display_name;

See https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streams for example output from this endpoint.

oh, thx so much!
Great works!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.