1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-06 08:37:30 +02:00
This commit is contained in:
Dag
2023-09-20 02:45:48 +02:00
committed by GitHub
parent cf7e3eea56
commit e6aef73a02
15 changed files with 134 additions and 384 deletions

View File

@@ -6,6 +6,21 @@ class HttpException extends \Exception
final class CloudFlareException extends HttpException
{
public static function isCloudFlareResponse(Response $response): bool
{
$cloudflareTitles = [
'<title>Just a moment...',
'<title>Please Wait...',
'<title>Attention Required!',
'<title>Security | Glassdoor',
];
foreach ($cloudflareTitles as $cloudflareTitle) {
if (str_contains($response->getBody(), $cloudflareTitle)) {
return true;
}
}
return false;
}
}
interface HttpClient
@@ -119,7 +134,7 @@ final class CurlHttpClient implements HttpClient
}
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$statusCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
return new Response($data, $statusCode, $responseHeaders);
}