To check if server can be connected to:
$a = '';
$link = "www.google.com";
$fp = fsockopen($link, 80, $errno, $errstr, 30);
if (!$fp) {
$a = "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: $link\r\n";
$out .= "Connection: Close\r\n\r\n";
// fwrite($fp, $out);
// while (!feof($fp)) {
// echo fgets($fp, 128);
// }
$a.=$out;
fclose($fp);
}
dump($a);
Op if success:
Top comments (0)