diff --git a/MatomoTracker.php b/MatomoTracker.php index 9e6ef2f..ac5235d 100644 --- a/MatomoTracker.php +++ b/MatomoTracker.php @@ -1708,15 +1708,21 @@ protected function sendRequest($url, $method = 'GET', $data = null, $force = fal ob_start(); $response = @curl_exec($ch); ob_end_clean(); + $header = ''; $content = ''; - + if ($response === false) { throw new \RuntimeException(curl_error($ch)); } - + if (!empty($response)) { - list($header, $content) = explode("\r\n\r\n", $response, $limitCount = 2); + // extract header + $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE); + $header = substr($response, 0, $headerSize); + + // extract content + $content = substr($response, $headerSize); } $this->parseIncomingCookies(explode("\r\n", $header));