Am I even doing this right...? (is_live integration into my own site)

This isn’t an error.

This is all the print_r’s outputting

This: https://github.com/BarryCarlyon/twitch_misc/blob/main/authentication/app_access_tokens/php/generate_and_maintain_token.php

I recognised a mistake in the code you originally posted (passing json_pretty_print to file_put_contents) which I’ve since fixed in the linked file in the last 10 minutes