Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ class Connection
protected ?\CurlHandle $curlHandle = null;
protected int $timeoutConnect = 15;
protected int $timeoutResponse = 30;
protected string $userAgent = 'phpFinTS';

public function __construct(string $url, int $timeoutConnect = 15, int $timeoutResponse = 30)
public function __construct(string $url, int $timeoutConnect = 15, int $timeoutResponse = 30, string $userAgent = 'phpFinTS')
{
$this->url = $url;
$this->timeoutConnect = $timeoutConnect;
$this->timeoutResponse = $timeoutResponse;
$this->userAgent = $userAgent;
}

/**
Expand All @@ -28,7 +30,7 @@ private function connect(): void

curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($this->curlHandle, CURLOPT_USERAGENT, 'phpFinTS');
curl_setopt($this->curlHandle, CURLOPT_USERAGENT, $this->userAgent);
curl_setopt($this->curlHandle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->curlHandle, CURLOPT_URL, $this->url);
curl_setopt($this->curlHandle, CURLOPT_CONNECTTIMEOUT, $this->timeoutConnect);
Expand Down
2 changes: 1 addition & 1 deletion src/FinTs.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ private function requireTanMode(): TanMode
*/
protected function newConnection(): Connection
{
return new Connection($this->options->url, $this->options->timeoutConnect, $this->options->timeoutResponse);
return new Connection($this->options->url, $this->options->timeoutConnect, $this->options->timeoutResponse, $this->options->userAgent);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/Options/FinTsOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ class FinTsOptions
*/
public $url;

/**
* The HTTP User-Agent header sent to the bank server. Some banks display this value in their
* registered devices or applications list.
* @var string
*/
public $userAgent = 'phpFinTS';

/** @var int */
public $timeoutConnect = 15;
/** @var int */
Expand Down
Loading