Example #1
0
 /**
  * Returns a Net_URL2 instance representing the URL used to retrieve the
  * current request.
  *
  * @throws Exception
  * @return $this
  */
 public static function getRequested()
 {
     if (!isset($_SERVER['REQUEST_METHOD'])) {
         // ALERT - no current URL
         throw new Exception('Script was not called through a webserver');
     }
     // Begin with a relative URL
     $url = new self($_SERVER['REQUEST_URI']);
     $url->_scheme = isset($_SERVER['HTTPS']) ? 'https' : 'http';
     // Set host and possibly port
     $url->setAuthority($_SERVER['HTTP_HOST']);
     return $url;
 }