3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function get_title($url){ $fp = file_get_contents($url); if (!$fp) return null; $res = preg_match("/<title>(.*)<\/title>/siU", $fp, $title_matches); if (!$res) return null; $title = preg_replace('/\s+/', ' ', $title_matches[1]); $title = trim($title); return $title; } get_title("http://google.com");
Output for 7.0.20, 7.1.5 - 7.3.0rc2
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/PDVMA on line 4 Warning: file_get_contents(http://google.com): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/PDVMA on line 4
Output for 5.5.0 - 7.0.8, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/PDVMA on line 4 Warning: file_get_contents(http://google.com): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/PDVMA on line 4