# Getting Streams

**URL:** <https://discuss.dev.twitch.com/t/getting-streams/1566>\
**Category:** API\
**Created:** [February 6, 2015, 1:02am UTC](https://discuss.dev.twitch.com/t/getting-streams/1566 "2015-02-06T01:02:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elixir22](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@Elixir22](https://discuss.dev.twitch.com/u/Elixir22)\
**Post date:** [February 6, 2015, 1:02am UTC](https://discuss.dev.twitch.com/t/getting-streams/1566/1 "2015-02-06T01:02:03Z")

</div>

This is my first time using a api,and im trying to learn , so im using this example [https://github.com/justintv/Twitch-API/blob/master/RESTful-Integration-Guide.md](https://github.com/justintv/Twitch-API/blob/master/RESTful-Integration-Guide.md) , and is supose to show the name of the top streamer , but only show name in the page . here is my code, i dont know what im doing wrong .

\<?php function get\_url\_contents($url){ $crl = curl\_init(); $timeout = 5; curl\_setopt ($crl, CURLOPT\_URL,$url); curl\_setopt ($crl, CURLOPT\_RETURNTRANSFER, 1); curl\_setopt ($crl, CURLOPT\_CONNECTTIMEOUT, $timeout); $ret = curl\_exec($crl); curl\_close($crl); return $ret; } $streams = json\_decode(get\_url\_contents("https://api.twitch.tv/kraken/streams")); echo "name" . $streams-\>streams[0]-\>channel-\>name; ?\>

---

<div class="post-metadata">

**Author:** ![Bufutda](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/bufutda/32/109_2.png) [@Bufutda](https://discuss.dev.twitch.com/u/Bufutda)\
**Post date:** [February 6, 2015, 6:12am UTC](https://discuss.dev.twitch.com/t/getting-streams/1566/2 "2015-02-06T06:12:53Z")

</div>

This code runs fine and prints the name of the first returned streamer from the api call to `/streams`. What issue are you getting?

---

<div class="post-metadata">

**Author:** ![Elixir22](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@Elixir22](https://discuss.dev.twitch.com/u/Elixir22)\
**Post date:** [February 9, 2015, 2:14pm UTC](https://discuss.dev.twitch.com/t/getting-streams/1566/3 "2015-02-09T14:14:21Z")

</div>

Its only display " name " (without quotes) in the screen . I cant post images

---

<div class="post-metadata">

**Author:** ![Bufutda](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/bufutda/32/109_2.png) [@Bufutda](https://discuss.dev.twitch.com/u/Bufutda)\
**Post date:** [February 12, 2015, 2:19am UTC](https://discuss.dev.twitch.com/t/getting-streams/1566/4 "2015-02-12T02:19:56Z")

</div>

It prints the concatenation of ‘name’ and the username of the first streamer object.  
If this is not what you are seeing, you may be running an out-of-date version of PHP.

 ![](https://d2opxh93rbxzdn.cloudfront.net/original/2X/2/29b11ce982801cbd2b6f8b4f186a50703f30d879.png)

---

<div class="post-metadata">

**Author:** ![Elixir22](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@Elixir22](https://discuss.dev.twitch.com/u/Elixir22)\
**Post date:** [February 12, 2015, 2:50pm UTC](https://discuss.dev.twitch.com/t/getting-streams/1566/5 "2015-02-12T14:50:46Z")

</div>

What php’s version do i need to work with the api?

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [February 22, 2015, 2:52pm UTC](https://discuss.dev.twitch.com/t/getting-streams/1566/6 "2015-02-22T14:52:03Z")

</div>

Closed on February 22, 2015, 2:52pm UTC

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