I am making a basic page that displays your WLAN IP address, i have an index.php as landing page and a getip.php that is required by index.php the problem that i am having is that the page will display the last ip that saved, and not yours, until the page is refreshed. i already tried with no cache and expires but no good. my question is.. how can i make it so the php variable gets pulled on page load and not just on refresh.. Thank You.
this is my index.php:
 <?php
  require "getip.php";
  $ip = getip();
  ?>
and then just:
<p style="text-align: center; color:white;">
 Your IP address is 
<span style="color:red;"> 
<?php
  echo $ip;
?>
</span>
</p>
and my getip.php:
<?php
function getip() {
    $ipaddress = '';
        if (getenv('HTTP_CLIENT_IP'))
            $ipaddress = getenv('HTTP_CLIENT_IP');
        else if(getenv('HTTP_X_FORWARDED_FOR'))
            $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
        else if(getenv('HTTP_X_FORWARDED'))
            $ipaddress = getenv('HTTP_X_FORWARDED');
        else if(getenv('HTTP_FORWARDED_FOR'))
            $ipaddress = getenv('HTTP_FORWARDED_FOR');
        else if(getenv('HTTP_FORWARDED'))
            $ipaddress = getenv('HTTP_FORWARDED');
        else if(getenv('REMOTE_ADDR'))
            $ipaddress = getenv('REMOTE_ADDR');
        else
            $ipaddress = 'UNKNOWN';
        return $ipaddress;
         }?>
 
    