$socket = fsockopen("www.ya.ru", 80, $errno, $errstr, 30); if(!$socket) die("Socket error: $errstr ($errno)");