I become always 500 Error

Hello everyone,

I have a big problem. I become the 500 error every time.

My Code:

<?php
$json_array = json_decode(@file_get_contents('https://api.twitch.tv/kraken/streams/twitch?client_id=id', true); //pulls stream data of online users from api
//checkes to see if stream is currently live
$channelTitle = $json_array['stream']['channel']['display_name']; //users display name
$streamTitle = $json_array['stream']['channel']['status']; //users stream title
$currentGame = $json_array['stream']['channel']['game']; //current game user is streaming
$channelLogo = $json_array['stream']['channel']['logo']; //users icon
$channelView = $json_array['stream']['viewers']; //# of current viewers

echo "<img scr='$channelLogo'>";
?>

Take out your client ID.

same problem

I was just remarking that you shouldn’t post you client ID here.

oh sorry :smiley: my english is not good

Should be

$json_array = json_decode(@file_get_contents(‘https://api.twitch.tv/kraken/streams/twitch?client_id=id’), true);

Thank you very much now it works

You can use php -l filename.php to run the PHP linter which will highlight syntax errors like this. Also a 500 error means “server fluff up” so you should check your server error log for what happened.