Putting a limit on streamlist in php code

138 views
Skip to first unread message

steven...@gmail.com

unread,
Aug 29, 2012, 1:47:50 PM8/29/12
to justintv-ap...@googlegroups.com
Hello,

I am using a php code to display a list of streams per category. I want to use the same code again somewhere else on a webpage but only show the top 5 streams and i was wondering if any of you know where i can add the limit tag? If i put it in the link to the API itself the code won't give me any result back.

Here is the php
<?php

$json = file_get_contents("http://api.justin.tv/api/stream/list.json?category=gaming&meta_game=StarCraft%20II:%20Wings%20of%20Liberty");

$elements = json_decode($json);

foreach ($elements as $element) {

/*$channel = get_object_vars($element->channel);
print_r(array_keys($channel));
echo '<a href="', $element->channel->channel_url, '" TARGET="_blank">';
echo '<strong>', $element->channel->title, '</strong> | ';
echo $element->stream_count, '<br />';
echo '<img src="', $element->channel->screen_cap_url_huge, '" WIDTH="640" HEIGHT="360"/>';
echo '</a>';
echo '';
}
?>

Mike Ossareh

unread,
Aug 29, 2012, 1:53:32 PM8/29/12
to justintv-ap...@googlegroups.com
Hi Steven,

Please use our new API - it supports proper pagination. https://github.com/justintv/Twitch-API/wiki/Streams-Resource


--
You received this message because you are subscribed to the Google Groups "Justin.tv API Developers" group.
To post to this group, send email to justintv-ap...@googlegroups.com.
To unsubscribe from this group, send email to justintv-api-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/justintv-api-developers/-/Iym35OYR9zEJ.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages