Undefined index: HTTP_HOST and more
Posted: Sun Sep 26, 2010 3:56 pm
Hey guys, for some reason this code:
(although its the last 2 lines of that where the apparent error is according to my debugger)
Generates these errors:
Undefined index: HTTP_HOST
Undefined index: REQUEST_URI
parse_url(http://) [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL
Any ideas?
Thanks!
Code: Select all
protected function getCurrentUrl() {
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
? 'https://'
: 'http://';
$currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$parts = parse_url($currentUrl);
Generates these errors:
Undefined index: HTTP_HOST
Undefined index: REQUEST_URI
parse_url(http://) [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL
Any ideas?
Thanks!