


// Domain WHOIS Lookup Shortcode for Elementor
function whois_lookup_shortcode($atts) {
    $domain = isset($_POST['whois_domain']) ? sanitize_text_field($_POST['whois_domain']) : '';
    if (!$domain) return '<form method="post"><input type="text" name="whois_domain" placeholder="Enter domain (e.g., google.com)" required><button type="submit">Check</button></form>';
    
    $api_key = 'at_asFTPYWiFVUEbUAZ6pYCeAjWmkhpW'; // আপনার actual API key
    $api_url = "https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey={$api_key}&domainName={$domain}&output=json";
    
    $response = wp_remote_get($api_url);
    if (is_wp_error($response)) return 'API Error';
    
    $data = json_decode(wp_remote_retrieve_body($response), true);
    if (empty($data['WhoisRecord'])) return 'No data found';
    
    $w = $data['WhoisRecord'];
    // যেহেতু আপনি বিস্তারিত চাচ্ছেন, নিচে সব ফিল্ড ম্যাপ করলাম
    $registrant = $w['registrant'] ?? [];
    $admin = $w['administrativeContact'] ?? [];
    $tech = $w['technicalContact'] ?? [];
    
    $html = '<div class="whois-result"><h3>Domain Info</h3>';
    $html .= "<p><strong>Domain Name:</strong> {$w['domainName']}</p>";
    $html .= "<p><strong>Host IP:</strong> {$w['nameServers']['hostNames'][0] ?? 'N/A'}</p>"; // IP direct দেওয়া না থাকলে
    $html .= "<p><strong>Registrar:</strong> {$w['registrarName']}</p>";
    $html .= "<p><strong>Service Provider:</strong> {$w['registrant']['organization'] ?? 'N/A'}</p>";
    $html .= "<p><strong>Registered On:</strong> {$w['createdDate']}</p>";
    $html .= "<p><strong>Age:</strong> " . (isset($w['createdDate']) ? floor((time() - strtotime($w['createdDate'])) / (365*24*3600)) . ' years' : 'N/A') . "</p>";
    $html .= "<p><strong>Expires On:</strong> {$w['expiresDate']}</p>";
    $html .= "<p><strong>Updated On:</strong> {$w['updatedDate']}</p>";
    $html .= "<p><strong>Registrar status:</strong> {$w['status']}</p>";
    $html .= "<p><strong>Name Servers:</strong> " . implode(', ', $w['nameServers']['hostNames'] ?? []) . "</p>";
    // Site View – সাধারণত url
    $html .= "<p><strong>Site View:</strong> <a href='http://{$domain}' target='_blank'>{$domain}</a></p>";
    
    // Registrant Info
    $html .= "<h4>Registrant Info</h4><p>Name: {$registrant['name']}<br>Organization: {$registrant['organization']}<br>Street: {$registrant['street1']}<br>City: {$registrant['city']}<br>Postal Code: {$registrant['postalCode']}<br>Country: {$registrant['country']}<br>Phone: {$registrant['telephone']}<br>Email: {$registrant['email']}</p>";
    
    // Admin Info
    $html .= "<h4>Admin Info</h4><p>Name: {$admin['name']}<br>Organization: {$admin['organization']}<br>Street: {$admin['street1']}<br>City: {$admin['city']}<br>Postal Code: {$admin['postalCode']}<br>Country: {$admin['country']}<br>Phone: {$admin['telephone']}<br>Email: {$admin['email']}</p>";
    
    // Technical Info
    $html .= "<h4>Technical Info</h4><p>Name: {$tech['name']}<br>Organization: {$tech['organization']}<br>Street: {$tech['street1']}<br>City: {$tech['city']}<br>Postal Code: {$tech['postalCode']}<br>Country: {$tech['country']}<br>Phone: {$tech['telephone']}<br>Email: {$tech['email']}</p>";
    
    $html .= '</div><form method="post"><input type="text" name="whois_domain" placeholder="Another domain"><button type="submit">Check Again</button></form>';
    return $html;
}
add_shortcode('whois_tool', 'whois_lookup_shortcode');<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://jahidul.info/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://jahidul.info/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://jahidul.info/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://jahidul.info/wp-sitemap-posts-ip_order-1.xml</loc></sitemap><sitemap><loc>https://jahidul.info/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://jahidul.info/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
