[PHP] Twitch token, return null


    $ch = curl_init('https://api.twitch.tv/kraken/oauth2/token');

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, 1);

    $fields = array(
        'client_id' => 'client_id',
        'client_secret' => 'client_secret',
        'grant_type' => 'authorization_code',
        'redirect_uri' => 'http://localhost/twitch',
        'code' => $_GET['code']

    $fields = http_build_query($fields);

    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    $data = curl_exec($ch);
    $response = json_decode($data, true);



With this code i get the return from curl “NULL”, i have read all i can about this in the twitch documentation but i can’t find where im wrong in the code. Anyone got any solution?

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