Professional Web Applications Themes

read the url - PHP Development

I would like a php script to be able to read the url that called that specific script. For instance, http://brian.some.long.url/index.php and http://nate.some.long.url/index.php would call the same script, but because of the differences in the initial word the script might react differently. Is there an easy way to access the url that called the script in php? I've been looking on the web, but haven't found anything....

  1. #1

    Default read the url

    I would like a php script to be able to read the url that called that
    specific script. For instance, http://brian.some.long.url/index.php and
    http://nate.some.long.url/index.php would call the same script, but
    because of the differences in the initial word the script might react
    differently. Is there an easy way to access the url that called the
    script in php? I've been looking on the web, but haven't found anything.

    lambelly Guest

  2. #2

    Default Re: read the url

    You can check out the value of the server variable HTTP_REFERER:

    $_SERVER['HTTP_REFERER']

    Keep in mind that this is set by the browser and can't really be
    trusted to give you accurate information (or any information at all).

    A better option would be to have the calling scripts pass some sort of
    variable either in the URL as a GET variable or through a form as a
    POST variable, the check the value of that variable on the receiving
    script.

    ZeldorBlat Guest

  3. #3

    Default Re: read the url

    "lambelly" <com> kirjoitti
    viestissä:googlegroups.com... 

    $_SERVER['HTTP_HOST'];
    Contents of the Host: header from the current request, if there is one.

    --
    SETI Home - Donate your cpu's idle time to science.
    Further reading at <http://setiweb.ssl.berkeley.edu/>

    Soulman <com>


    Kimmo Guest

  4. #4

    Default Re: read the url

    that seems to be what I was looking for. Thanks!

    lambelly Guest

  5. #5

    Default Re: read the url

    <com> : 

    Maybe you should consider adding this to your forms:
    in first:
    <input type="hidden" name="from" value="brian">
    and
    <input type="hidden" name="from" value="nate">
    in the second form.

    and then the php script would just have to check $_REQUEST['from']

    Regards,
    Talthen


    Guest

  6. #6

    Default Re: read the url

    On 2005-08-03 20-51-15 <pl> wrote: 
    >
    > Maybe you should consider adding this to your forms:
    > in first:
    > <input type="hidden" name="from" value="brian">
    > and
    > <input type="hidden" name="from" value="nate">
    > in the second form.
    >
    > and then the php script would just have to check $_REQUEST['from']
    >
    > Regards,
    > Talthen[/ref]

    to add this information, he has to know it before... therefore this is
    quite pointless...

    HTH,
    Simon
    --
    Simon Stienen <http://slashlife.org/>
    "What you do in this world is a matter of no consequence,
    The question is, what can you make people believe that you have done."
    /Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/
    Simon Guest

Similar Threads

  1. HEY READ THIS!
    By justupset in forum Macromedia Flash Player
    Replies: 8
    Last Post: June 24th, 02:54 AM
  2. Help: Program to read from EOR end of last read?
    By snoopy_@excite.com in forum Linux / Unix Administration
    Replies: 3
    Last Post: April 7th, 12:32 PM
  3. File system get auto change from read-write to read-oly
    By RC in forum Linux / Unix Administration
    Replies: 1
    Last Post: October 23rd, 10:51 PM
  4. Read & Read/Write Groups
    By Damien Harrod in forum Sun Solaris
    Replies: 1
    Last Post: July 22nd, 01:52 PM

Bookmarks

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