new file: software/app.php
new file: software/debug.php new file: software/module/report/routes.php new file: software/module/update/routes.php new file: software/public/index.php new file: software/router.php
This commit is contained in:
1 parent
87e828962b
commit
dc78008721
6 files changed
+233
No files matched your search
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class DumpHTTPRequestToFile {
|
||||
private static function getHeaderList() {
|
||||
$headerList = [];
|
||||
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (preg_match('/^HTTP_/',$name)) {
|
||||
// convert HTTP_HEADER_NAME to Header-Name
|
||||
$name = strtr(substr($name,5),'_',' ');
|
||||
$name = ucwords(strtolower($name));
|
||||
$name = strtr($name,' ','-');
|
||||
|
||||
// add to list
|
||||
$headerList[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $headerList;
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function execute($targetFile) {
|
||||
$data = sprintf(
|
||||
"%s %s %s\n\nHTTP headers:\n",
|
||||
$_SERVER['REQUEST_METHOD'],
|
||||
$_SERVER['REQUEST_URI'],
|
||||
$_SERVER['SERVER_PROTOCOL']
|
||||
);
|
||||
foreach (self::getHeaderList() as $name => $value) {
|
||||
$data .= $name . ': ' . $value . "\n";
|
||||
}
|
||||
|
||||
$data .= "\nRequest body:\n";
|
||||
|
||||
file_put_contents(
|
||||
$targetFile,
|
||||
$data . file_get_contents('php://input') . "\n"
|
||||
);
|
||||
|
||||
//echo("Done!\n\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user