Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    96
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Exclamation Server variables to php

    Hi,

    Not sure if I should post this here or in the php forum.

    Basically, I have the following asp script which is outputting all my server variables:

    <%
    dim ServerVariables
    for each ServerVariables in Request.ServerVariables
    if left(ServerVariables,5)="HTTP_" then
    response.write "<tr><td>"&ServerVariables &"</td><td><B>"&URLDecode(Request.ServerVariables(ServerVariables))&"</b></td></tr>"
    end if
    next

    %>

    Which works fine. But when I try to output the server variables in php using this:

    <?
    foreach($_SERVER as $key_name => $key_value) {
    print $key_name . " = " . $key_value . "<br>";
    }
    ?>

    All the server variables that appear in asp do not appear in php - does anyone know why this is or how to resolve this problem?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Quote Originally Posted by icklechurch View Post
    Hi,

    Not sure if I should post this here or in the php forum.

    Basically, I have the following asp script which is outputting all my server variables:

    <%
    dim ServerVariables
    for each ServerVariables in Request.ServerVariables
    if left(ServerVariables,5)="HTTP_" then
    response.write "<tr><td>"&ServerVariables &"</td><td><B>"&URLDecode(Request.ServerVariables(ServerVariables))&"</b></td></tr>"
    end if
    next

    %>

    Which works fine. But when I try to output the server variables in php using this:

    <?
    foreach($_SERVER as $key_name => $key_value) {
    print $key_name . " = " . $key_value . "<br>";
    }
    ?>

    All the server variables that appear in asp do not appear in php - does anyone know why this is or how to resolve this problem?
    This should probably be in the PHP forum, so I'll move it there.
    _SERVER is set by the web server software in use, and since ASP requires an IIS server (ignoring mono), it is likely that MS has access to more variables.
    Is there something in particular you are looking for?

    Edit:
    I'm not that familiar with ASP, but the HTTP_ leading makes me believe you're looking at request information. Is that what you're looking for, from the URL and from posted forms? If so, they are in _GET and _POST respectively.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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