Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:07:30+00:00 2026-06-13T05:07:30+00:00

Tell please what script uses zend framework for definition current URL? More exactly I

  • 0

Tell please what script uses zend framework for definition current URL? More exactly I interest what use ZEND for definition domain name: this $_SERVER['HTTP_HOST'] or this
$_SERVER['SERVER_NAME'] ? (or may be something other)?

P.S. ( I search in documentation but not found, (I do not know this framework), also I search in google, but also not found answer on my question? )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:07:31+00:00Added an answer on June 13, 2026 at 5:07 am

    Try use: $this->getRequest()->getRequestUri() to get current of requested URI.

    In the view script use: $this->url() to get current URL.

    Or using via static integrated Zend Controller front via instance:

    $uri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();

    You can get a value of URI implementation via singleton to get a value of request() data:

    $request = Zend_Controller_Front::getInstance()->getRequest();
    $url = $request->getScheme() . '://' . $request->getHttpHost();
    

    On the View use it as:

    echo $this->serverUrl(true); # return with controller, action,...
    

    You should avoid hardcode such as example (NOT TO USE!):

    echo 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
    

    instead of this example use as on a view:

    $uri = $this->getRequest()->getHttpHost() . $this->view->url();
    

    If you want using getRequest in ZEND more explore The Request Object.

    SKIP IT BELOW (AUTOPSY EXAMPLE HOW WORKS IT).

    Full of example code how getRequestUri() how it works and why is isRequest instead using $_SERVER is because on a platform specific is randomly get a data:

    first if uri null, thand if requested from IIS set is as HTTP_X_REWRITE_URL. If not, check on IIS7 rewritten uri (include encoded uri). If not on IIS than REQUEST_URI will check scheme of HTTP_HOSTNAME, or if failed use as ORIG_PATH_INFO and grab a QUERY_STRING.

    If is setted, grab a data automatically via string of returned object $this in a class.

    If failed, than will be set a parsed string than set it.

    if ($requestUri === null) {
            if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch
                $requestUri = $_SERVER['HTTP_X_REWRITE_URL'];
            } elseif (
                // IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
                isset($_SERVER['IIS_WasUrlRewritten'])
                && $_SERVER['IIS_WasUrlRewritten'] == '1'
                && isset($_SERVER['UNENCODED_URL'])
                && $_SERVER['UNENCODED_URL'] != ''
                ) {
                $requestUri = $_SERVER['UNENCODED_URL'];
            } elseif (isset($_SERVER['REQUEST_URI'])) {
                $requestUri = $_SERVER['REQUEST_URI'];
                // Http proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
                $schemeAndHttpHost = $this->getScheme() . '://' . $this->getHttpHost();
                if (strpos($requestUri, $schemeAndHttpHost) === 0) {
                    $requestUri = substr($requestUri, strlen($schemeAndHttpHost));
                }
            } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI
                $requestUri = $_SERVER['ORIG_PATH_INFO'];
                if (!empty($_SERVER['QUERY_STRING'])) {
                    $requestUri .= '?' . $_SERVER['QUERY_STRING'];
                }
            } else {
                return $this;
            }
        } elseif (!is_string($requestUri)) {
            return $this;
        } else {
            // Set GET items, if available
            if (false !== ($pos = strpos($requestUri, '?'))) {
                // Get key => value pairs and set $_GET
                $query = substr($requestUri, $pos + 1);
                parse_str($query, $vars);
                $this->setQuery($vars);
            }
        }
    
        $this->_requestUri = $requestUri;
        return $this;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want obtain full URL adres in php script, tell please, this code always
Can anyone please tell me what exactly this script does? #! /bin/sh test –f
Could you please tell me what does @src stands for in action script 3
Can anyone please tell me how I can write a bash shell script that
Can anyone please tell me how do I make this script run in IE
Can anyone please tell me what is wrong with this script. I am a
Please tell me what is the difference in bash shell between launching a script
Can one of you jQuery kings please tell me why my script.asp will not
Could someone please tell me if there is someway to invoke the SQL Script
Can someone please tell me what I am doing wrong here? <script type=text/javascript> (document).ready(function()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.