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: 61895
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Fri, 03 May 2024 11:53:14 GMT
Etag: "3147526947+ident"
Expires: Fri, 10 May 2024 11:53:14 GMT
Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT
Server: ECAcc (nyd/D14C)
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