Help i cannot get the info from twitch api json

Hi guys i trying to get info from twitch channels but i dont get any info this my code

$ch = curl_init();

curl_setopt_array($ch, array(
	  'Client-ID: ' . $clientId
   CURLOPT_URL => '' . $canales[$var]

$response = curl_exec($ch);

$json = json_decode($response, true); //No he probado si esto efectivamente regresa el json

//----Revisamos si el stream está en vivo----

if($json['stream'] != null){
	$tweet = creaTweet($response, $canales[$var]); // Pedimos el texto que se publicará enviando el json del canal y su nombre
	$response = $tw->post('statuses/update', $tweet); // Se postea el tweet - no estoy segura si esta función sigue vigente


Does it return any errors at all? Also, I am assuming this block of code is within a foreach loop, as break; doesn’t do anything for a If/Else statement and it’ll throw a Fatal Error.

Here is the entire code please help

No error i just post the entire code is my Twitter bot that twit a streamer from list whit twitter user twtich channel and game also create a screenshot.

I’ve removed the link and would highly recommend you take that Pastebin down. It has your secret and an access token for Twitter included. Those are considered private information.

Your Twitch-related code works fine. I just tried it locally without issue. I’m guessing it is the Twitter-related code that isn’t working. In particular:

    $tweet = creaTweet($response, $canales[$var]);

You’re passing in the entire $response object instead of $jsonResultado. That means that multiple variables in other functions could cause errors ( $pathImagen, for example).

1 Like

Thanks yea i change secret code after a post :slight_smile: i forgot that.

Thanks! sorry i not really good whit coding i just bought the code from a friend but she is unable to update and fix so what i need to change? please.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.