how to get ip address of client in php script???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vishal

    how to get ip address of client in php script???

    how can i get ip address of client in my php script???


    thxs

  • Michel

    #2
    Re: how to get ip address of client in php script???

    You can get the IP by using the following bit of code:

    ### get IP address ###
    $ip = (getenv(HTTP_X_ FORWARDED_FOR))
    ? getenv(HTTP_X_F ORWARDED_FOR)
    : getenv(REMOTE_A DDR);


    Best regards,

    Michel


    "vishal" <vishal_panjabi @yahoo.co.in> wrote in message
    news:1112091132 .096095.326250@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    > how can i get ip address of client in my php script???
    >
    >
    > thxs
    >[/color]


    Comment

    • vishal

      #3
      Re: how to get ip address of client in php script???

      is it same as getting ip address using

      $ip = $_SERVER["REMOTE_ADD R"];

      is there any difference ??

      Comment

      • frizzle

        #4
        Re: how to get ip address of client in php script???

        Personally i prefer:
        $isp = isset($REMOTE_H OST) ? $REMOTE_HOST :
        @gethostbyaddr( $REMOTE_ADDR);

        Since ip addresses change more often, this should give you more
        consistent information for eg a counter...

        Comment

        Working...