<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API Documentation - Geolocation IP Tracker | RSK World</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        .docs-container {
            background: rgba(255,255,255,0.95);
            border-radius: 15px;
            margin: 2rem auto;
            max-width: 1200px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        }
        .docs-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 2rem;
            border-radius: 15px 15px 0 0;
            text-align: center;
        }
        .docs-content {
            padding: 2rem;
        }
        .endpoint-card {
            border: 2px solid #e9ecef;
            border-radius: 10px;
            margin-bottom: 2rem;
            overflow: hidden;
        }
        .endpoint-header {
            background: #f8f9fa;
            padding: 1rem 1.5rem;
            border-bottom: 2px solid #e9ecef;
        }
        .endpoint-method {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            border-radius: 20px;
            font-weight: bold;
            font-size: 0.875rem;
            margin-right: 1rem;
        }
        .method-get { background: #28a745; color: white; }
        .method-post { background: #007bff; color: white; }
        .endpoint-url {
            font-family: 'Courier New', monospace;
            font-weight: bold;
            color: #495057;
        }
        .endpoint-body {
            padding: 1.5rem;
        }
        .code-block {
            background: #2d3748;
            color: #e2e8f0;
            border-radius: 8px;
            padding: 1rem;
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
            overflow-x: auto;
        }
        .response-example {
            background: #f8f9fa;
            border-left: 4px solid #28a745;
            padding: 1rem;
            margin-top: 1rem;
            border-radius: 0 8px 8px 0;
        }
        .error-example {
            background: #f8f9fa;
            border-left: 4px solid #dc3545;
            padding: 1rem;
            margin-top: 1rem;
            border-radius: 0 8px 8px 0;
        }
        .feature-list li {
            margin-bottom: 0.5rem;
        }
        .footer {
            text-align: center;
            color: white;
            padding: 2rem;
            margin-top: 2rem;
        }
        .nav-pills .nav-link {
            border-radius: 25px;
            margin-bottom: 0.5rem;
        }
        .nav-pills .nav-link.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
    </style>
</head>
<body>
    <!--
    API Documentation for Geolocation IP Tracker
    Author: RSK World
    Founder: Molla Samser
    Designer & Tester: Rima Khatun
    Website: https://rskworld.in
    Contact: help@rskworld.in, +91 93305 39277
    Year: 2026
    -->
    
    <div class="container">
        <div class="docs-container">
            <div class="docs-header">
                <i class="fas fa-book fa-3x mb-3"></i>
                <h1>Geolocation IP Tracker API</h1>
                <p class="lead">Advanced IP geolocation tracking and detailed location information retrieval</p>
                <p class="mb-0">Version 1.0 | Developed by <strong>RSK World</strong> | © 2026</p>
            </div>
            
            <div class="docs-content">
                <div class="row">
                    <div class="col-md-3">
                        <nav class="nav nav-pills flex-column">
                            <a class="nav-link active" href="#overview">Overview</a>
                            <a class="nav-link" href="#authentication">Authentication</a>
                            <a class="nav-link" href="#endpoints">Endpoints</a>
                            <a class="nav-link" href="#responses">Responses</a>
                            <a class="nav-link" href="#examples">Examples</a>
                            <a class="nav-link" href="#errors">Error Handling</a>
                            <a class="nav-link" href="#rate-limiting">Rate Limiting</a>
                        </nav>
                    </div>
                    
                    <div class="col-md-9">
                        <section id="overview" class="mb-5">
                            <h2><i class="fas fa-info-circle me-2"></i>Overview</h2>
                            <p>The Geolocation IP Tracker API provides detailed location information for any IP address. This service offers comprehensive geolocation data including country, region, city, ISP, timezone, and more.</p>
                            
                            <h4>Features</h4>
                            <ul class="feature-list">
                                <li><i class="fas fa-check text-success me-2"></i>IP-based geolocation lookup</li>
                                <li><i class="fas fa-check text-success me-2"></i>Country and city data</li>
                                <li><i class="fas fa-check text-success me-2"></i>ISP and organization information</li>
                                <li><i class="fas fa-check text-success me-2"></i>Timezone detection</li>
                                <li><i class="fas fa-check text-success me-2"></i>Mobile and proxy detection</li>
                                <li><i class="fas fa-check text-success me-2"></i>Bulk IP lookup support</li>
                                <li><i class="fas fa-check text-success me-2"></i>Built-in caching for performance</li>
                                <li><i class="fas fa-check text-success me-2"></i>CORS support for web applications</li>
                            </ul>
                        </section>
                        
                        <section id="authentication" class="mb-5">
                            <h2><i class="fas fa-key me-2"></i>Authentication</h2>
                            <p>This API is currently <strong>free to use</strong> and does not require authentication. However, rate limiting may be applied to ensure fair usage.</p>
                            <div class="alert alert-info">
                                <i class="fas fa-info-circle me-2"></i>
                                <strong>Note:</strong> For production use with high volume requests, consider implementing API key authentication.
                            </div>
                        </section>
                        
                        <section id="endpoints" class="mb-5">
                            <h2><i class="fas fa-plug me-2"></i>API Endpoints</h2>
                            
                            <div class="endpoint-card">
                                <div class="endpoint-header">
                                    <span class="endpoint-method method-get">GET</span>
                                    <span class="endpoint-url">/index.php</span>
                                </div>
                                <div class="endpoint-body">
                                    <h5>Get IP Location</h5>
                                    <p>Retrieve geolocation information for a specific IP address or the current client IP.</p>
                                    
                                    <h6>Parameters</h6>
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>
                                                <th>Parameter</th>
                                                <th>Type</th>
                                                <th>Required</th>
                                                <th>Description</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td><code>ip</code></td>
                                                <td>string</td>
                                                <td>No</td>
                                                <td>IP address to lookup. If not provided, uses the client's IP.</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    
                                    <div class="response-example">
                                        <strong>Example Request:</strong>
                                        <div class="code-block">GET /index.php?ip=8.8.8.8</div>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="endpoint-card">
                                <div class="endpoint-header">
                                    <span class="endpoint-method method-post">POST</span>
                                    <span class="endpoint-url">/index.php/bulk</span>
                                </div>
                                <div class="endpoint-body">
                                    <h5>Bulk IP Lookup</h5>
                                    <p>Retrieve geolocation information for multiple IP addresses in a single request.</p>
                                    
                                    <h6>Request Body</h6>
                                    <div class="code-block">{
    "ips": ["8.8.8.8", "1.1.1.1", "208.67.222.222"]
}</div>
                                    
                                    <div class="response-example">
                                        <strong>Example Request:</strong>
                                        <div class="code-block">POST /index.php/bulk
Content-Type: application/json

{
    "ips": ["8.8.8.8", "1.1.1.1"]
}</div>
                                    </div>
                                </div>
                            </div>
                        </section>
                        
                        <section id="responses" class="mb-5">
                            <h2><i class="fas fa-exchange-alt me-2"></i>Response Format</h2>
                            
                            <h5>Success Response</h5>
                            <div class="response-example">
                                <div class="code-block">{
    "success": true,
    "data": {
        "status": "success",
        "country": "United States",
        "countryCode": "US",
        "region": "CA",
        "regionName": "California",
        "city": "Mountain View",
        "district": null,
        "zip": "94043",
        "lat": 37.4056,
        "lon": -122.0775,
        "timezone": "America/Los_Angeles",
        "offset": -25200,
        "isp": "Google LLC",
        "org": "Google LLC",
        "as": "AS15169 Google LLC",
        "asname": "GOOGLE",
        "mobile": false,
        "proxy": false,
        "hosting": true,
        "query": "8.8.8.8"
    },
    "timestamp": "2026-03-08 17:30:45",
    "api_info": {
        "provider": "ip-api.com",
        "version": "1.0",
        "developer": "RSK World",
        "website": "https://rskworld.in",
        "year": "2026"
    }
}</div>
                            </div>
                            
                            <h5>Error Response</h5>
                            <div class="error-example">
                                <div class="code-block">{
    "success": false,
    "error": "Invalid IP address provided",
    "timestamp": "2026-03-08 17:30:45",
    "api_info": {
        "provider": "ip-api.com",
        "version": "1.0",
        "developer": "RSK World",
        "website": "https://rskworld.in",
        "year": "2026"
    }
}</div>
                            </div>
                        </section>
                        
                        <section id="examples" class="mb-5">
                            <h2><i class="fas fa-code me-2"></i>Code Examples</h2>
                            
                            <h5>JavaScript (Fetch API)</h5>
                            <div class="code-block">// Get location for specific IP
fetch('/index.php?ip=8.8.8.8')
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            console.log('Location:', data.data);
        } else {
            console.error('Error:', data.error);
        }
    });

// Get location for current IP
fetch('/index.php')
    .then(response => response.json())
    .then(data => console.log(data));</div>
                            
                            <h5>PHP (cURL)</h5>
                            <div class="code-block"><?php
$ip = '8.8.8.8';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "/index.php?ip=$ip");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

if ($data['success']) {
    echo "Country: " . $data['data']['country'];
} else {
    echo "Error: " . $data['error'];
}
?></div>
                            
                            <h5>Python (requests)</h5>
                            <div class="code-block">import requests

# Get location for specific IP
response = requests.get('/index.php?ip=8.8.8.8')
data = response.json()

if data['success']:
    print(f"Country: {data['data']['country']}")
    print(f"City: {data['data']['city']}")
else:
    print(f"Error: {data['error']}")

# Bulk lookup
bulk_data = {"ips": ["8.8.8.8", "1.1.1.1"]}
response = requests.post('/index.php/bulk', json=bulk_data)
print(response.json())</div>
                        </section>
                        
                        <section id="errors" class="mb-5">
                            <h2><i class="fas fa-exclamation-triangle me-2"></i>Error Handling</h2>
                            <p>The API returns appropriate HTTP status codes and error messages for various scenarios:</p>
                            
                            <table class="table table-striped">
                                <thead>
                                    <tr>
                                        <th>HTTP Status</th>
                                        <th>Error Message</th>
                                        <th>Description</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>400</td>
                                        <td>Invalid IP address provided</td>
                                        <td>The IP address format is invalid</td>
                                    </tr>
                                    <tr>
                                        <td>404</td>
                                        <td>Endpoint not found</td>
                                        <td>The requested API endpoint doesn't exist</td>
                                    </tr>
                                    <tr>
                                        <td>405</td>
                                        <td>Method not allowed</td>
                                        <td>HTTP method is not supported for this endpoint</td>
                                    </tr>
                                    <tr>
                                        <td>500</td>
                                        <td>Failed to fetch geolocation data</td>
                                        <td>External service error or network issue</td>
                                    </tr>
                                </tbody>
                            </table>
                        </section>
                        
                        <section id="rate-limiting" class="mb-5">
                            <h2><i class="fas fa-tachometer-alt me-2"></i>Rate Limiting</h2>
                            <p>To ensure fair usage and service stability, the following rate limits apply:</p>
                            <ul>
                                <li><strong>Free Tier:</strong> 100 requests per minute</li>
                                <li><strong>Bulk Requests:</strong> Maximum 50 IP addresses per request</li>
                                <li><strong>Caching:</strong> Results are cached for 1 hour to improve performance</li>
                            </ul>
                            
                            <div class="alert alert-warning">
                                <i class="fas fa-exclamation-triangle me-2"></i>
                                <strong>Important:</strong> Exceeding rate limits may result in temporary suspension of access.
                            </div>
                        </section>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <footer class="footer">
        <div class="container">
            <p class="mb-2">
                <strong>RSK World</strong> - Your Programming Resource Hub
            </p>
            <p class="mb-1">
                Founded by Molla Samser | Designed & Tested by Rima Khatun
            </p>
            <p class="mb-2">
                <i class="fas fa-envelope me-2"></i>help@rskworld.in
                <i class="fas fa-phone ms-3 me-2"></i>+91 93305 39277
            </p>
            <p class="mb-0">
                Nutanhat, Mongolkote, Purba Burdwan, West Bengal, India - 713147
            </p>
            <p class="mb-0 mt-2">
                <a href="https://rskworld.in" target="_blank" class="text-white text-decoration-none">
                    <i class="fas fa-globe me-1"></i>https://rskworld.in
                </a>
            </p>
            <hr class="my-3 bg-white">
            <p class="mb-0">© 2026 RSK World. All rights reserved. | Content for educational purposes only.</p>
        </div>
    </footer>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-javascript.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-php.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
    
    <script>
        // Smooth scrolling for navigation
        document.querySelectorAll('.nav-link').forEach(link => {
            link.addEventListener('click', function(e) {
                e.preventDefault();
                const targetId = this.getAttribute('href');
                const targetSection = document.querySelector(targetId);
                
                if (targetSection) {
                    targetSection.scrollIntoView({
                        behavior: 'smooth',
                        block: 'start'
                    });
                    
                    // Update active nav link
                    document.querySelectorAll('.nav-link').forEach(navLink => {
                        navLink.classList.remove('active');
                    });
                    this.classList.add('active');
                }
            });
        });
        
        // Update active nav link on scroll
        window.addEventListener('scroll', function() {
            const sections = document.querySelectorAll('section[id]');
            const navLinks = document.querySelectorAll('.nav-link');
            
            let current = '';
            sections.forEach(section => {
                const sectionTop = section.offsetTop;
                const sectionHeight = section.clientHeight;
                if (pageYOffset >= sectionTop - 100) {
                    current = section.getAttribute('id');
                }
            });
            
            navLinks.forEach(link => {
                link.classList.remove('active');
                if (link.getAttribute('href') === '#' + current) {
                    link.classList.add('active');
                }
            });
        });
    </script>
</body>
</html>
