Website Performance Analyzing Tool using PHP
In today’s fast-paced digital world, a website’s performance can make or break its user experience. A slow-loading site or poor server response times can lead to decreased user engagement and even revenue losses. To address these challenges, we introduce the Website Performance Analyzer, a robust tool designed to help website owners and developers gain actionable insights into their site’s performance metrics.
Follow this video for complete guidance:
Full Source Code : Website Performance Analyzer
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Website Performance Analyzer</title> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/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"> <style> .bg-gradient-purple { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); } .hover-lift { transition: transform 0.3s ease; } .hover-lift:hover { transform: translateY(-5px); } </style> </head> <body class="bg-light"> <div class="bg-gradient-purple text-white py-5 shadow-sm"> <div class="container"> <h1 class="text-center display-5 fw-bold mb-3">Website Performance Analyzer</h1> <p class="text-center lead mb-0 opacity-75">Get detailed insights into your website's performance metrics</p> </div> </div> <div class="container my-5"> <div class="card border-0 shadow-sm p-4 mb-5"> <form action="" method="POST"> <div class="input-group input-group-lg"> <span class="input-group-text border-0 bg-white"> <i class="fas fa-globe text-primary"></i> </span> <input type="text" name="url" value="<?php echo @$_POST['url'];?>" class="form-control border-0 shadow-none" placeholder="Enter website URL (e.g., https://example.com)" required> <button type="submit" class="btn btn-primary px-4"> <i class="fas fa-tachometer-alt me-2"></i>Analyze </button> </div> </form> </div> <?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $url = filter_var($_POST['url'], FILTER_VALIDATE_URL); if ($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); $total_time = curl_getinfo($ch, CURLINFO_TOTAL_TIME); $dns_time = curl_getinfo($ch, CURLINFO_NAMELOOKUP_TIME); $connect_time = curl_getinfo($ch, CURLINFO_CONNECT_TIME); $ssl_time = curl_getinfo($ch, CURLINFO_APPCONNECT_TIME); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); $content = @file_get_contents($url); $page_size = $content ? strlen($content) : 0; if ($http_code) { ?> <div class="row g-4"> <div class="col-md-4"> <div class="card border-0 shadow-sm h-100 hover-lift"> <div class="card-body text-center p-4"> <div class="rounded-circle bg-primary bg-opacity-10 p-3 d-inline-block mb-3"> <i class="fas fa-clock fa-2x text-primary"></i> </div> <h5 class="text-uppercase text-muted small mb-3">Total Load Time</h5> <h3 class="text-primary mb-0"><?php echo round($total_time * 1000, 2); ?> ms</h3> </div> </div> </div> <div class="col-md-4"> <div class="card border-0 shadow-sm h-100 hover-lift"> <div class="card-body text-center p-4"> <div class="rounded-circle bg-success bg-opacity-10 p-3 d-inline-block mb-3"> <i class="fas fa-search fa-2x text-success"></i> </div> <h5 class="text-uppercase text-muted small mb-3">DNS Lookup</h5> <h3 class="text-success mb-0"><?php echo round($dns_time * 1000, 2); ?> ms</h3> </div> </div> </div> <div class="col-md-4"> <div class="card border-0 shadow-sm h-100 hover-lift"> <div class="card-body text-center p-4"> <div class="rounded-circle bg-info bg-opacity-10 p-3 d-inline-block mb-3"> <i class="fas fa-server fa-2x text-info"></i> </div> <h5 class="text-uppercase text-muted small mb-3">Server Response</h5> <h3 class="text-info mb-0"><?php echo $http_code; ?></h3> </div> </div> </div> <div class="col-md-4"> <div class="card border-0 shadow-sm h-100 hover-lift"> <div class="card-body text-center p-4"> <div class="rounded-circle bg-warning bg-opacity-10 p-3 d-inline-block mb-3"> <i class="fas fa-plug fa-2x text-warning"></i> </div> <h5 class="text-uppercase text-muted small mb-3">Connection Time</h5> <h3 class="text-warning mb-0"><?php echo round($connect_time * 1000, 2); ?> ms</h3> </div> </div> </div> <div class="col-md-4"> <div class="card border-0 shadow-sm h-100 hover-lift"> <div class="card-body text-center p-4"> <div class="rounded-circle bg-danger bg-opacity-10 p-3 d-inline-block mb-3"> <i class="fas fa-lock fa-2x text-danger"></i> </div> <h5 class="text-uppercase text-muted small mb-3">SSL Time</h5> <h3 class="text-danger mb-0"><?php echo round($ssl_time * 1000, 2); ?> ms</h3> </div> </div> </div> <div class="col-md-4"> <div class="card border-0 shadow-sm h-100 hover-lift"> <div class="card-body text-center p-4"> <div class="rounded-circle bg-secondary bg-opacity-10 p-3 d-inline-block mb-3"> <i class="fas fa-file fa-2x text-secondary"></i> </div> <h5 class="text-uppercase text-muted small mb-3">Page Size</h5> <h3 class="text-secondary mb-0"><?php echo round($page_size / 1024, 2); ?> KB</h3> </div> </div> </div> </div> <?php } else { echo '<div class="alert alert-danger shadow-sm border-0">Error: Unable to connect to the URL.</div>'; } } else { echo '<div class="alert alert-danger shadow-sm border-0">Invalid URL. Please enter a valid URL.</div>'; } } ?> </div> </body> </html>
What is the Website Performance Analyzer?
The Website Performance Analyzer is a web-based tool that simplifies the process of analyzing key performance metrics for any website. By inputting a URL, users can instantly evaluate various technical aspects, such as load time, DNS lookup time, server response, SSL handshake time, and overall page size.
The tool provides detailed insights in an easy-to-understand, visually appealing format, enabling developers to identify bottlenecks and optimize their websites effectively.
Why Website Performance Matters?
Website performance is critical for several reasons:
- User Experience: Faster websites retain users longer and improve satisfaction.
- Search Engine Ranking: Search engines like Google prioritize fast-loading websites, making performance a key SEO factor.
- Conversion Rates: Studies show that even a one-second delay in page load time can reduce conversions by up to 7%.
- Accessibility: Performance optimization ensures better accessibility for users with slower internet connections.
Key Features of the Tool
- Total Load Time : This metric measures how quickly the website’s resources are fetched and rendered. It helps in identifying slow-loading pages that may frustrate users.
- DNS Lookup Time : DNS lookup time tracks how long it takes to resolve the website’s domain name to its corresponding IP address. High DNS lookup times can indicate inefficient domain configurations.
- Server Response Time : This feature highlights how quickly the server responds to requests. Faster response times indicate a well-optimized server.
- SSL Handshake Time : The time taken to establish a secure HTTPS connection is crucial for websites requiring secure data transmission.
- Page Size : This metric shows the total size of the website’s resources, such as images, scripts, and stylesheets. Optimizing page size can significantly enhance loading speeds.
How It Works
Using the Website Performance Analyzer is simple:
- Enter the URL of the website you wish to analyze in the provided input box.
- Click on the Analyze button.
- The tool processes the website and returns a detailed report of performance metrics, displayed in an intuitive, card-based layout.
Who Can Benefit from This Tool?
This tool is ideal for:
- Web Developers: Debug performance issues during development or after deployment.
- SEO Specialists: Monitor site performance and ensure it meets SEO standards.
- Business Owners: Understand how their website performs in real-world scenarios and take steps to improve user experience.
Why Choose the Website Performance Analyzer?
The Website Performance Analyzer stands out because of its simplicity, efficiency, and visually enriched interface. Unlike other tools that require extensive configurations, this tool delivers performance insights in just a few clicks. Its user-friendly design makes it accessible to both technical and non-technical users.
The Website Performance Analyzer is a must-have tool for anyone seeking to improve their website’s speed, reliability, and user experience. Whether you’re troubleshooting a slow-loading page or planning an overall optimization strategy, this tool provides the actionable insights needed to achieve your goals.
Take control of your website’s performance today and deliver the best possible experience to your audience!