mirror of
https://github.com/RobThree/TwoFactorAuth.git
synced 2026-08-19 00:14:30 +00:00
b964b2abbf
it's already bad to use an external provider, let's use the safest defaults at least
30 lines
747 B
PHP
30 lines
747 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace RobThree\Auth\Providers\Qr;
|
|
|
|
abstract class BaseHTTPQRCodeProvider implements IQRCodeProvider
|
|
{
|
|
protected bool $verifyssl = true;
|
|
|
|
protected function getContent(string $url): string|bool
|
|
{
|
|
$curlhandle = curl_init();
|
|
|
|
curl_setopt_array($curlhandle, array(
|
|
CURLOPT_URL => $url,
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_CONNECTTIMEOUT => 10,
|
|
CURLOPT_DNS_CACHE_TIMEOUT => 10,
|
|
CURLOPT_TIMEOUT => 10,
|
|
CURLOPT_SSL_VERIFYPEER => $this->verifyssl,
|
|
CURLOPT_USERAGENT => 'TwoFactorAuth',
|
|
));
|
|
$data = curl_exec($curlhandle);
|
|
|
|
curl_close($curlhandle);
|
|
return $data;
|
|
}
|
|
}
|