I have a basic understanding of English, so I apologize if there are any errors. I’m attempting to access the Twitch API through PHP, but sadly, I’m encountering an error.
You’re missing the authentication headers that Twitch API requires now. Your request won’t work without Client-ID and Authorization token headers, regardless of using the correct Helix endpoint. I faced a similar issue migrating my Twitch integration last year. You’ll need to avoid file_get_contents since you can’t add custom headers easily. I switched to cURL with the appropriate context options. Additionally, the property you’re trying to access doesn’t exist in that format anymore; the new API structure is completely different from what you might be expecting.
You’re using the old Kraken API that Twitch deprecated in 2022, which is likely why you’re encountering this error. You need to transition to the Helix API and ensure that you’re sending the appropriate authentication headers. Start by registering an application on the Twitch Developer Console to obtain your Client ID and access token. It’s also advisable to use cURL instead of file_get_contents, as cURL allows for easier handling of the authorization headers. Additionally, be aware that the response structure has changed; ‘display_Name’ is no longer used in the new API.
for sure! the kraken API is toast, so u gotta move to Helix. don’t forget to add the client-id in your request headers or u won’t get any results. also, use cURL instead of file_get_contents; it’s way better for handling those headers.
Your problem is using an outdated endpoint without proper auth. Switching to the Helix API won’t fix everything though - you’ll still hit CORS issues and SSL certificate problems with file_get_contents for external calls. For dev work, set up a stream context and disable SSL verification (never do this in production). When I migrated similar code, I found that most shared hosts block outbound requests to certain domains by default. Test your connection first - run a simple cURL from command line to check if you can even reach the API. The property structure changed completely, so dig through the current API docs before you go any further.
This goes way beyond just the deprecated endpoint. I hit something similar with external APIs - your server’s probably blocking all outbound HTTPS requests. First, check your PHP error logs since that @ symbol is hiding the actual error messages. Most hosts disable allow_url_fopen by default for security, which breaks file_get_contents for remote URLs. Even after you switch to the Helix API with proper auth, you’ll likely need to contact your host about firewall restrictions. Also, display_Name doesn’t exist in the current API structure anymore - they changed how streams are identified in the response.