Leçon N° 20 : Courrier, réseau
Envoyer un ping
***
Notes de page
Source: lesson_20_c_envoyer_un_ping.phpRésultat
<?php
$fp 
fsockopen("www.example.com"80$errno$errstr30);
if (!
$fp) {
    echo 
"$errstr ($errno)<br />\n";
} else {
    
$out "GET / HTTP/1.1\r\n";
    
$out .= "Host: www.example.com\r\n";
    
$out .= "Connection: Close\r\n\r\n";
 
    
fwrite($fp$out);
    while (!
feof($fp)) {
        echo 
fgets($fp128)."<br/>";
    }
    
fclose($fp);
}
?>



HTTP/1.1 200 OK
Age: 370572
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Thu, 28 Mar 2024 16:56:41 GMT
Etag: "3147526947+gzip+ident"
Expires: Thu, 04 Apr 2024 16:56:41 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECS (nyd/D164)
Vary: Accept-Encoding
X-Cache: HIT
Content-Length: 1256
Connection: close




Example Domain









Example Domain


This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.


More information...






Tous droits réservés. 2005-2020