API not always providing user ID

$kanal=“$daten[twitch_user_name]”; //comes from database

Should be just

$kanal= $daten[twitch_user_name]; //comes from database

No idea, this looks like a problem in your code somewhere. As I can see that skilltecs exists.

Check your response HTTP codes and see if you are getting a timeout.

Aside from that no idea whats going on, your code samples don’t cover everything that is going on