Encoding Problems [check-user-subscription-by-channel] / PHP

Hey,
I’m trying this:

<?php
$curl = curl_init();
include 'twitchtv.php';
$twitchtv = new TwitchTV;
echo '<a href="'.$twitchtv->authenticate().'">Authenticate Me</a><br/>';
$ttv_code = $_GET['code'];
$access_token = $twitchtv->get_access_token($ttv_code);
$user_name = $twitchtv->authenticated_user($access_token);
if (isset($user_name)) {
$client_id = $twitchtv->get_userid($user_name);
echo 'Thank you '.$user_name.'!  Authentication Completed!';

$botid = "<BOT CLIENT ID>";
$idurl = "https://api.twitch.tv/kraken/users/".$client_id."/subscriptions/45704064";

$ch = curl_init();

curl_setopt_array($ch, array(
   CURLOPT_HTTPHEADER => array(
  'Client-ID: ' . $botid ,
  'Authorization: OAuth' . $access_token
   ),
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_URL => $idurl
));

$response = curl_exec($ch);
curl_close($ch);

echo "<br />";
echo $response;


}

I want to find out if a user subscripted to a specific channel, but I always get a wrong encoded Output like this:

Thank you cr4zyeasy! Authentication Completed!
�]BZ�1�0����8�}@cI%ZPh4�]o�a�L G�%����M	z��9�C�a,�3�kҍX��s5(�Β��ll��=���1��AY

Other Requests are working fine for me…
What am I doing wrong?

Add this:

curl_setopt($ch, CURLOPT_ENCODING , “gzip”);

Further more, the response was so small that it didn’t go “oooh gzip” automagically and you got an auth fail

Thanks!!

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