Created
September 27, 2018 12:33
-
-
Save katzueno/e48cc3a3f7f98b6489da62524726c7c8 to your computer and use it in GitHub Desktop.
Request debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// /application/bootstrap/app.php | |
/* | |
* ---------------------------------------------------------------------------- | |
* ## Request Debug | |
* ---------------------------------------------------------------------------- | |
*/ | |
Route::register('/ccm/c5-request_test_wKKv8AEYlB7F27WE', function() { | |
header("Pragma: no-cache"); | |
echo '<dl>'; | |
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); | |
?><dt>Application environment:</dt><dd><?php echo ($app->environment()) ? $app->environment() : 'default'; ?></dd><?php | |
$request = \Concrete\Core\Http\Request::getInstance(); | |
?><dt>Client IP:</dt><dd><?php echo $request->getClientIp(); ?></dd><?php | |
?><dt>Host:</dt><dd><?php echo $request->getHost(); ?></dd><?php | |
?><dt>Port:</dt><dd><?php echo $request->getPort(); ?></dd><?php | |
?><dt>Scheme:</dt><dd><?php echo $request->getScheme(); ?></dd><?php | |
?><dt>Secure:</dt><dd><?php echo ($request->isSecure()) ? 'true' : 'false'; ?></dd><?php | |
?><dt>Canonical URL:</dt><dd><?php echo \Core::make('url/canonical'); ?></dd><?php | |
?><dt>Get all headers:</dt><dd><pre><?php var_dump(c5getallheaders()); ?></pre></dd><?php | |
echo '</dl>'; | |
}); | |
if(!function_exists('c5getallheaders')) | |
{ | |
function c5getallheaders() | |
{ | |
$headers = []; | |
foreach ($_SERVER as $name => $value) | |
{ | |
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; | |
} | |
return $headers; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment