3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php header('Content-type: text/html; charset=utf-8'); // эта функция отправляет команду в сокет, и возвращает ответ от сервера function sWrite( $socket, $data, $echo = true ){ // отображаем отправляемую команду, если это требуется //if( $echo ) echo $data; // отправляем команду в сокет fputs( $socket, $data ); // получаем первый байт ответа от сервера $answer = fread( $socket, 1 ); // узнаем информацию о состоянии потока $remains = socket_get_status( $socket ); // и получаем оставшиеся байты ответа от сервера if( $remains --> 0 ) $answer .= fread( $socket, $remains['unread_bytes'] ); // функция возвращает ответ от сервера на переданную команду return $answer; } // адрес электропочты, который надо проверить $email = "admin@fcdk.kiev.ua"; // получаем данные об MX-записи домена, указанного в email $mx = dns_get_record( end( explode( "@", $email ) ), DNS_MX ); $mx = $mx[0]['target']; // открываем сокет и создаем поток $socket = fsockopen( $mx, 25, $errno, $errstr, 10 ); if( !$socket ){ //echo "$errstr ($errno)\n"; }else{ // отправляем пустую строку, чтобы получить приветствие сервера /*echo*/ sWrite( $socket, "" ); // представляемся сами /*echo*/ sWrite( $socket, "EHLO example.com\r\n" ); /*echo*/ sWrite( $socket, "MAIL FROM: dummy@example.com\r\n" ); // запрашиваем разрешение на отправку письма адресату $response = sWrite( $socket, "RCPT TO: $email\r\n" ); //echo $response; // закрываем соединение /*echo*/ sWrite( $socket, "QUIT\r\n" ); fclose( $socket ); // ниже идет простейшая обработка полученного ответа //echo "\nCheck report:\n"; if( substr_count( $response, "550" ) > 0 ) echo "Ящикa ".$email." нет.<br>"; else if( substr_count( $response, "250" ) > 0 ) if( substr_count( $response, "OK" ) > 0 ) echo "Ящик ".$email." есть.<br>"; else echo "Ящик ".$email." есть, но он какой-то странный (like a relay host).<br>"; else echo "Ящик ".$email." не был распознан <br>"; } //variant 2 if( $curl = curl_init() ) { curl_setopt($curl, CURLOPT_URL, 'http://stealthdebuger.com/post/'); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, "email=".$email); $out = curl_exec($curl); //echo $out; curl_close($curl); } $out = iconv("Windows-1251", "UTF-8", $out); $out_arr = explode('<h5>Проверка существования email</h5><hr>', $out); $res2 = $out_arr[1]; $out_arr = explode('</h5><hr>', $res2); $res2 = $out_arr[0]; $answer = trim(strip_tags($res2)); echo $answer;
Output for 7.0.0 - 7.0.3, 7.0.5 - 7.1.0
Notice: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: dns_get_record(): A temporary server error occurred. in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/7H3ck on line 27 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/7H3ck:52 Stack trace: #0 {main} thrown in /in/7H3ck on line 52
Process exited with code 255.
Output for 7.0.4
Notice: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: dns_get_record(): A temporary server error occurred. in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: System error) in /in/7H3ck on line 27 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/7H3ck:52 Stack trace: #0 {main} thrown in /in/7H3ck on line 52
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined index: 1 in /in/7H3ck on line 63
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.6.17, 5.6.20 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: dns_get_record(): A temporary server error occurred. in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.5.33, 5.6.18 - 5.6.19
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: dns_get_record(): A temporary server error occurred. in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: System error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.3.2 - 5.3.28, 5.4.0 - 5.4.27, 5.4.42 - 5.4.45
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Notice: Undefined offset: 0 in /in/7H3ck on line 25 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: System error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.3.29, 5.4.28 - 5.4.41
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Notice: Undefined offset: 0 in /in/7H3ck on line 25 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.3.1
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: System error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.2.6 - 5.3.0
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: dns_get_record(): res_nsend() failed in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (php_network_getaddresses: getaddrinfo failed: System error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.1.0 - 5.2.5
Strict Standards: Only variables should be passed by reference in /in/7H3ck on line 24 Warning: dns_get_record(): res_nsend() failed in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (Unknown error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.0.5
Fatal error: Only variables can be passed by reference in /in/7H3ck on line 24
Process exited with code 255.
Output for 5.0.3 - 5.0.4
Warning: dns_get_record(): res_nsend() failed in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: System error in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (Unknown error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Warning: dns_get_record(): res_nsend() failed in /in/7H3ck on line 24 Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in /in/7H3ck on line 27 Warning: fsockopen(): unable to connect to :25 (Unknown error) in /in/7H3ck on line 27 Fatal error: Call to undefined function curl_init() in /in/7H3ck on line 52
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: dns_get_record() in /in/7H3ck on line 24
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: dns_get_record() in /in/7H3ck on line 24
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: dns_get_record() in /in/7H3ck on line 24