1 2 3 4 5 6 7 8 9 10 11
<?php $url='http://www.ndtv.com/'; $data = file_get_contents($url); $title = get_title($data); echo $title; function get_title($html) { return preg_match('!<title>(.*?)</title>!i', $html, $matches) ? $matches[1] : ''; } ?>
1 2 3 4
Warning: file_get_contents(http://www.ndtv.com/): failed to open stream: No such file or directory on line 3 Warning: preg_match(): Internal pcre_fullinfo() error -3 on line 8