Skip to content

Commit

Permalink
Merge pull request #10 from ericnicolaas/php56
Browse files Browse the repository at this point in the history
Closes #9 - Fixes HTTP headers when apache_request_headers() is not available
  • Loading branch information
stymiee authored Jun 18, 2020
2 parents ca848ff + abdc4a7 commit ff15d97
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/authnet/AuthnetWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,13 @@ protected function getAllHeaders()
if (function_exists('apache_request_headers')) {
$headers = apache_request_headers();
} else {
$headers = array_filter($_SERVER, function($key) {
return strpos($key, 'HTTP_') === 0;
}, ARRAY_FILTER_USE_KEY);
$headers = [];
foreach ($_SERVER as $key => $value) {
if (strpos($key, 'HTTP_') === 0) {
$headers[str_replace('_', '-', substr($key, 5))] = $value;
}
}
}
return $headers;
}
}
}

0 comments on commit ff15d97

Please sign in to comment.