0

Why it takes an infinite amount of time for this ?

function getCurrentPageUrl() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}    

$headers = get_headers(getCurrentPageUrl());
hakre
  • 193,403
  • 52
  • 435
  • 836
Rebol Tutorial
  • 2,738
  • 2
  • 25
  • 36

1 Answers1

3

It's a recursive request. The problem is that you are requesting to load this script and the script which is loading is trying to load it in its self an so on and so on :)

Karolis
  • 9,396
  • 29
  • 38
  • Oh really :) Well I was trying to find a substitute for this on Apache http://stackoverflow.com/questions/6359352/why-this-php-apache-request-headers-doesnt-work-on-iis-7 which doesn't work on IIS. – Rebol Tutorial Jun 15 '11 at 17:23
  • What I want in final is just to get the user agent ! – Rebol Tutorial Jun 15 '11 at 17:24
  • 1
    You can just get it from `$_SERVER['HTTP_USER_AGENT']` – Karolis Jun 15 '11 at 17:27
  • @Karolis: That'd be the user agent of the person requesting the script. I think OP wants the user agent that PHP will identify itself as. – Marc B Jun 15 '11 at 17:43
  • @Marc B, I don't think so because PHP's user agent identity is a known and fully controllable thing by a developer. Why would he need to get thing which he knows? :) – Karolis Jun 15 '11 at 17:52