Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: How to get the client IP address in PHP #129
    vanshika
    Participant

    As shown below, covered two possible methods for getting the client IP address from a PHP script:

    Using getenv() function: To obtain the IP address, we utilise the getenv(“REMOTE ADDR”) method.
    In PHP, the getenv() method is used to retrieve the values of an environment variable. It is used to return the value of a specific environment variable.

    Syntax:

    <?php
     $ipaddress = getenv("REMOTE_ADDR") ;
     Echo "Your IP Address is " . $ipaddress;
    ?>

    Determining IP Address using $_SERVER Variable Method: Another method is to use the $_SERVER[‘REMOTE ADDR’] or $_SERVER[‘REMOTE HOST’] variables to obtain the IP Address. The $_SERVER array variables are produced by web servers such as apache and can be utilised in PHP.
    $_SERVER[‘REMOTE ADDR’] basically returns the IP address from which the request was submitted to the web server.
    Syntax:

    <?php
     $ipaddress = $_SERVER['REMOTE_ADDR']
     Echo "Your IP Address is " . $ipaddress;
    ?>
    vanshika
    Participant

    You can animate an HTML element with a class of “box” by adding a single change in gsap code in your JS Code:
    gsap.to(".box", { xPercent: -200 });

Viewing 2 posts - 1 through 2 (of 2 total)
Scroll to Top