<?php

function check_website_status($url) {
    $handle = curl_init($url);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
    $response = curl_exec($handle);
    $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
    curl_close($handle);

    if ($httpCode >= 200 && $httpCode < 300) {
        return "Website is up and running.";
    } else {
        return "Website is down with status code $httpCode.";
    }
}

// Example usage:
$url = "https://www.example.com";
$status = check_website_status($url);
echo $status;

?>

Questo script definisce una funzione check_website_status che accetta un URL come input e restituisce un messaggio che indica se il sito Web è attivo o inattivo. Puoi sostituire "https://www.example.com" con l'URL del sito web che desideri controllare.

Commenti (0)

Non ci sono ancora commenti qui, puoi essere il primo!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *


Scegliere e acquistare il Proxy

Proxy per data center

Proxy a rotazione

Proxy UDP

Scelto da oltre 10.000 clienti in tutto il mondo

Cliente proxy
Cliente proxy
Cliente proxy flowch.ai
Cliente proxy
Cliente proxy
Cliente proxy