The easiest way would be just adding it to the URL, so
if ($mysocket(twitchuptime,https://api.twitch.tv/kraken/streams?channel= $+ $2)) {
becomes
if ($mysocket(twitchuptime,https://api.twitch.tv/kraken/streams?client_id=<your_client_id_here>&channel= $+ $2)) {