In your example you define $clientid but never use it.
Also, remove the “.json” from the send of the API URL since that is not the correct syntax.
https://api.twitch.tv/kraken/streams.json?channel=mastersonothing should be https://api.twitch.tv/kraken/streams?channel=mastersonothing