diff --git a/src/snapchat_agent.php b/src/snapchat_agent.php index 004d40b..4b52d86 100644 --- a/src/snapchat_agent.php +++ b/src/snapchat_agent.php @@ -457,21 +457,21 @@ public function post($endpoint, $data, $params, $multipart = FALSE, $debug = FAL exit(); } } + } - if($endpoint == "/bq/get_captcha") + 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=(?[^\s]+|\x22[^\x22]+\x22)\x3B?.*$/m', $headers, $matches)) { - file_put_contents(__DIR__."/captcha.zip", $result); - rewind($headerBuff); - $headers = stream_get_contents($headerBuff); - if(preg_match('/^Content-Disposition: .*?filename=(?[^\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"; + $filename = trim($matches['f'],' ";'); + rename(__DIR__."/captcha.zip", __DIR__."/{$filename}"); + return $filename; } + fclose($headerBuff); + return "captcha.zip"; } $gi = curl_getinfo($ch);