fix: various small fixes (#3578)

This commit is contained in:
Dag 2023-07-29 00:14:30 +02:00 committed by GitHub
parent 11ce8b5dcd
commit 701fe3cfed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 87 additions and 39 deletions

View file

@ -490,18 +490,22 @@ class VkBridge extends BridgeAbstract
private function getContents()
{
$header = ['Accept-language: en', 'Cookie: remixlang=3'];
$httpHeaders = [
'Accept-language: en',
'Cookie: remixlang=3',
];
$redirects = 0;
$uri = $this->getURI();
while ($redirects < 2) {
$response = getContents($uri, $header, [CURLOPT_FOLLOWLOCATION => false], true);
$response = getContents($uri, $httpHeaders, [CURLOPT_FOLLOWLOCATION => false], true);
if (in_array($response['code'], [200, 304])) {
return $response['content'];
}
$uri = urljoin(self::URI, $response['header']['location'][0]);
$headers = $response['headers'];
$uri = urljoin(self::URI, $headers['location'][0]);
if (str_contains($uri, '/429.html')) {
returnServerError('VK responded "Too many requests"');