<?php
    require_once('.hta_config/siliconpin_sp.php');
    $publicIPv4 = file_get_contents('https://ipv4.icanhazip.com/');
    $publicIPv6 = @file_get_contents('https://ipv6.icanhazip.com/');
    $userIP = $_SERVER['REMOTE_ADDR'];
    $ipLocation = 'Unknown';
    $isp = 'Unknown';
    $ipLocationData = @file_get_contents("http://ip-api.com/json/$userIP");
    // $ipLocationData = @file_get_contents("http://ip-api.com/json/$userIP?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,district,zip,lat,lon,timezone,offset,currency,isp,org,as,asname,reverse,mobile,proxy,hosting,query");
    if ($ipLocationData !== false) {
        $ipLocationData = json_decode($ipLocationData, true);
        if (isset($ipLocationData['status']) && $ipLocationData['status'] == 'success') {
            $ipLocation = isset($ipLocationData['city']) ? $ipLocationData['city'] . ', ' . $ipLocationData['country'] : 'Unknown';
            $isp = isset($ipLocationData['isp']) ? $ipLocationData['isp'] : 'Unknown';
        }
    }

?>
<?php
$web_page_title = 'Your IP Address - siliconpin.com';
$web_page_meta_description = 'Find out your current IP address';
$web_page_meta_keywords = 'IP address, internet, network';
$web_page_author = 'Your Name';
$web_page_meta_og_title = $web_page_title;
$web_page_meta_og_description = $web_page_meta_description;
$web_page_meta_og_image = ''; // Add URL to an image if desired
$web_page_meta_og_url = 'http://siliconpin.com/what-is-my-ip'; // Update URL
$web_page_meta_twitter_title = $web_page_title;
$web_page_meta_twitter_description = $web_page_meta_description;
$web_page_meta_twitter_image = ''; // Add URL to an image if desired
$web_page_meta_twitter_card = 'summary'; // or 'summary_large_image' if you have a large image
require_once('.htac_header.php');
require_once('.htac_nav.php');
?>
<section class="container mx-auto custom-container" style="margin-top: 100px; margin-bottom: 10px;">
    <p><?php echo "My Public IPv4: $publicIPv4 <br>"; ?></p>
    <p><?php echo "My Public IPv6: " . ($publicIPv6 ? $publicIPv6 : 'IPv6 not supported or unavailable') . "<br>"; ?></p>
    <p><?php echo "My IP Location: $ipLocation <br>"; ?></p>
    <p><?php echo "My ISP: $isp"; ?></p>
</section>
<?php
?>
