mgp25 / SC-API

Snapchat’s private API
MIT License
334 stars 106 forks source link

Captcha doesn't work if not in debug #193

Closed melaurent closed 9 years ago

melaurent commented 9 years ago

In snapchat_agent.php, the captcha zip file is only saved if $debug is set to true.

        if($debug)
        {
        ...
            if($endpoint == "/bq/get_captcha")
            {
                file_put_contents(__DIR__."/captcha.zip", $result);
                rewind($headerBuff);
                $headers = stream_get_contents($headerBuff);
                if(preg_match('/^Content-Disposition: .*?filename=(?<f>[^\s]+|\x22[^\x22]+\x22)\x3B?.*$/m', $headers, $matches))
                {
                    $filename = trim($matches['f'],' ";');
                    rename(__DIR__."/captcha.zip", __DIR__."/{$filename}");
                    return $filename;
                }
                fclose($headerBuff);
                return "captcha.zip";
            }

This has to get out of the if($debug) statement.