getting the browser url line (newbe)

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default getting the browser url line (newbe)

    Hi ,

    How do I get the Url from the browser window? All examples start from an
    input hard coded url.

    Jean


    Québec Guest

  2. Similar Questions and Discussions

    1. newbe
      Clif Gallagher wrote: To start kde on boot: edit /etc/inittab change the line: id:3:initdefault: to id:5:initdefault:
    2. Newbe needs help.
      Here is my question: I have a webservice that "expose " a function "PutPhoto". This function is used by an asp.net app to send a photo ....
    3. Newbe php help
      I have an HTML form with Firstname, lastname, address I want to save the firstname, lastname and address appended to a file in say results.txt,...
    4. [PHP] execute command line script from browser
      Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script...
    5. execute command line script from browser
      Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script...
  3. #2

    Default Re: getting the browser url line (newbe)

    *** Québec wrote/escribió (Sun, 5 Sep 2004 07:28:39 -0400):
    > How do I get the Url from the browser window? All examples start from an
    > input hard coded url.
    You actually cannot, since that info is never sent to server. However, you
    can figure out:

    $protocol=$_SERVER['HTTPS']=='on'? 'https': 'http';
    $user=$_SERVER['PHP_AUTH_USER'];
    $password=$_SERVER['PHP_AUTH_PW'];
    $host=$_SERVER['HTTP_HOST'];
    $port=$_SERVER['SERVER_PORT'];
    $uri=$_SERVER['REQUEST_URI'];

    $full_url=$protocol . '://';
    if($user){
    $full_url.=rawurlencode($user);
    }
    if($password){
    $full_url.=':' . rawurlencode($password);
    }
    if($user || $password){
    $full_url.='@';
    }
    ............ God the idea, don't you?



    In any case, I'm pretty sure what you actually need is just this:

    $_SERVER['PHP_SELF'];



    Use this code to get all available variables:

    echo '<pre>';
    print_r($_SERVER);
    echo '</pre>';


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- Questions sent to my mailbox will be billed ;-)
    --
    Alvaro G Vicario Guest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139