Skip to content

Instantly share code, notes, and snippets.

<?php
// Check this request has a GitLab header
function checkHeader($gitlab_header) {
if (!isset($gitlab_header)) {
throw new Exception("Can't be accessed directly.");
}
}
try { checkHeader($_SERVER['HTTP_X_GITLAB_EVENT']); }