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 , 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; ?>This code runs fine and prints the name of the first returned streamer from the api call to /streams. What issue are you getting?
Its only display " name " (without quotes) in the screen . I cant post images
What php’s version do i need to work with the api?
