Script doesnt work

You should STOP using file_get_contents and use cURL instead.

It’s possible that the file_get_contents is failing and you are not checking the response for it.

Further more you need to be sending a Client-ID in the header, as per the Twitch API Rules of the Road, which you just can’t do with file_get_contents