Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

Commit d9a98a7

Browse files
committed
Fixes #193
1 parent 1959bcc commit d9a98a7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/snapchat_agent.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -457,21 +457,21 @@ public function post($endpoint, $data, $params, $multipart = FALSE, $debug = FAL
457457
exit();
458458
}
459459
}
460+
}
460461

461-
if($endpoint == "/bq/get_captcha")
462+
if($endpoint == "/bq/get_captcha")
463+
{
464+
file_put_contents(__DIR__."/captcha.zip", $result);
465+
rewind($headerBuff);
466+
$headers = stream_get_contents($headerBuff);
467+
if(preg_match('/^Content-Disposition: .*?filename=(?<f>[^\s]+|\x22[^\x22]+\x22)\x3B?.*$/m', $headers, $matches))
462468
{
463-
file_put_contents(__DIR__."/captcha.zip", $result);
464-
rewind($headerBuff);
465-
$headers = stream_get_contents($headerBuff);
466-
if(preg_match('/^Content-Disposition: .*?filename=(?<f>[^\s]+|\x22[^\x22]+\x22)\x3B?.*$/m', $headers, $matches))
467-
{
468-
$filename = trim($matches['f'],' ";');
469-
rename(__DIR__."/captcha.zip", __DIR__."/{$filename}");
470-
return $filename;
471-
}
472-
fclose($headerBuff);
473-
return "captcha.zip";
469+
$filename = trim($matches['f'],' ";');
470+
rename(__DIR__."/captcha.zip", __DIR__."/{$filename}");
471+
return $filename;
474472
}
473+
fclose($headerBuff);
474+
return "captcha.zip";
475475
}
476476

477477
$gi = curl_getinfo($ch);

0 commit comments

Comments
 (0)