3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function get_http_response_code($url) { $headers = get_headers($url); // echo substr($headers[0], 9, 3); $headers = substr($headers[0], 9, 3); // $headers = "bla"; // setting headers to bla works then $b = bla; var_dump($headers); //returns string 3 (404) return $headers; } $b = get_http_response_code('http://www.redcoon.es/res/shop/cataloge/product_200/B351504.jpg'); var_dump($b);
based on aup20
Output for 7.0.20, 7.1.5 - 7.2.0
Warning: get_headers(): php_network_getaddresses: getaddrinfo failed: System error in /in/Q1aDE on line 4 Warning: get_headers(http://www.redcoon.es/res/shop/cataloge/product_200/B351504.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Q1aDE on line 4 bool(false) bool(false)
Output for 5.5.0 - 7.0.9, 7.1.0
Warning: get_headers(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Q1aDE on line 4 Warning: get_headers(http://www.redcoon.es/res/shop/cataloge/product_200/B351504.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Q1aDE on line 4 bool(false) bool(false)