<?
function get_title ($url) {
if (filter_var($url, FILTER_VALIDATE_URL)) {
$data = file_get_contents('http://gmodules.com/ig/proxy?url='.$url);
preg_match('/\<title\>(.*)\<\/title\>/', $data, $title);
print (strlen($title[1]) != 0) ? $title[1] : 'ERROR: TITLE_EMPTY';
}
else {
print 'ERROR: URL_INCORRECT';
}
}
header('Content-type: text/html; charset=utf-8');
get_title('https://www.cloudflare.com/');
?>