Forum Moderators: coopster

Message Too Old, No Replies

Cannot get IP address behind a proxy server

What did I do wrong?

         

irock

12:33 am on Jul 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I got a parse error from this code... what did I do wrong?

<?
    if (getenv(HTTP_X_FORWARDED_FOR))
        $ipaddress = getenv(HTTP_X_FORWARDED_FOR);
    else
        $ipaddress = getenv(REMOTE_ADDR);
?>

Thanks.

rlkanter

12:54 am on Jul 20, 2004 (gmt 0)

10+ Year Member



What is the parse error?

I tried it, and it works fine (well changed the <? to <?php ) :)

coopster

1:58 am on Jul 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are the requests being forwarded through a proxy? If so, check the User Contributed notes on the getenv() [php.net] page.