Skip to content

Commit 9d2ee0e

Browse files
committed
Add curl_reset and remove CURLOPT_HTTP_VERSION
1 parent 94469cc commit 9d2ee0e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/Scanpay.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,16 @@ private function request(string $path, array $opts = [], array $data = null): ar
5656

5757
$curlopts = [
5858
CURLOPT_URL => 'https://' . ($opts['hostname'] ?? 'api.scanpay.dk') . $path,
59-
CURLOPT_CUSTOMREQUEST => 'GET',
6059
CURLOPT_HTTPHEADER => array_values($headers),
6160
CURLOPT_VERBOSE => $opts['debug'] ?? 0,
6261
CURLOPT_TCP_KEEPALIVE => 1, // TODO: CURLOPT_TCP_KEEPINTVL & CURLOPT_TCP_KEEPIDLE
6362
CURLOPT_RETURNTRANSFER => 1,
6463
CURLOPT_CONNECTTIMEOUT => 20,
65-
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_2TLS,
6664
CURLOPT_TIMEOUT => 120,
6765
CURLOPT_DNS_CACHE_TIMEOUT => 180,
6866
//CURLOPT_DNS_SHUFFLE_ADDRESSES => 1,
6967
];
7068
if (isset($data)) {
71-
$curlopts[CURLOPT_CUSTOMREQUEST] = 'POST';
7269
$curlopts[CURLOPT_POSTFIELDS] = json_encode($data, JSON_UNESCAPED_SLASHES);
7370
if ($curlopts[CURLOPT_POSTFIELDS] === false) {
7471
throw new \Exception('Failed to JSON encode request to Scanpay: ' . json_last_error_msg());
@@ -83,6 +80,7 @@ private function request(string $path, array $opts = [], array $data = null): ar
8380
$curlopts[$key] = $val;
8481
}
8582
}
83+
curl_reset($this->ch);
8684
curl_setopt_array($this->ch, $curlopts);
8785
$result = curl_exec($this->ch);
8886
if ($result === false) {

0 commit comments

Comments
 (0)