1 // [HTTP_X_FORWARDED_PROTO] => https // [HTTP_X_FORWARDED_PORT] => 443 if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO']) { return true; } else if (!empty($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS']) { return true; } return false; } // @usage: Request::getScriptUri(); public static function getScriptUri() { // [SCRIPT_URI] => http://biuro.biall-net.pl:34543/dev-pl/se-master/wfs-qgis.php/default_db/ // [SCRIPT_URL] => /dev-pl/se-master/wfs-qgis.php/default_db/ // [SCRIPT_NAME] => /dev-pl/se-master/wfs-qgis.php // [HTTP_HOST] => biuro.biall-net.pl $uri = (Request::isHttps())? 'https://' : 'http://'; $uri .= "{$_SERVER['HTTP_HOST']}{$_SERVER['SCRIPT_URL']}"; return $uri; } // @usage: Request::getPathUri(); public static function getPathUri() { // [SCRIPT_URI] => http://biuro.biall-net.pl:34543/dev-pl/se-master/wfs-qgis.php/default_db/ // [SCRIPT_URL] => /dev-pl/se-master/wfs-qgis.php/default_db/ // [SCRIPT_NAME] => /dev-pl/se-master/wfs-qgis.php // [HTTP_HOST] => biuro.biall-net.pl $uri = (Request::isHttps())? 'https://' : 'http://'; $uri .= $_SERVER['HTTP_HOST']; $scriptPath = ''; $scriptName = $_SERVER['SCRIPT_NAME']; if ('/' == substr($scriptName, -1)) { $scriptPath = $scriptName; } else { $scriptPathEx = explode('/', $scriptName); array_pop($scriptPathEx); $scriptPath = implode('/', $scriptPathEx) . '/'; } $uri .= $scriptPath; return $uri; } // @usage: Request::getRewriteTaskPath(); public static function getRewriteTaskPath() { $reqUri = $_SERVER['REQUEST_URI']; $reqScript = $_SERVER['SCRIPT_NAME']; $taskPath = str_replace($reqScript, '', $reqUri); return $taskPath; } // @usage: Request::getRequestBody(); public static function getRequestBody() { static $requestBody = null; if (null === $requestBody) { $requestBody = file_get_contents("php://input"); } return $requestBody; } }