...

View Full Version : Server variables to php



icklechurch
09-15-2009, 09:52 AM
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?

Fou-Lu
09-15-2009, 01:39 PM
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?


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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum