401 - Failing call from server, but works in browser

That seems a long way deep in your program, sure it’s this lookup failing?

Thanks for the full path on your server!

Best kill that oAuth!

Please use cURL.

99.9% of the time file_get_contents performing a HTTP request should fail due to correctly set security settings on the host.

cURL will also allow you to correctly set headers nicely.

For example:

        $curl = curl_init('https://api.twitch.tv/kraken/user');
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            'Accept: application/vnd.twitchtv.v5+json',
            'Authorization: OAuth ' . MYOAUTH
        ));
        $result = curl_exec($curl);
        $i = curl_getinfo($curl);
        curl_close($curl);

        if ($i['http_code'] == 200) {
            $result = json_decode($result);
            // do something with $result
        } else {
            echo 'Failed with a ' . $i['http_code'];
        }