Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
function getTitle($url) {
$data = file_get_contents($url);
$title = preg_match('/<title[^>]*>(.*?)<\/title>/ims', $data, $matches) ? $matches[1] : null;
return $title;
}
$url_og = "https://net-raft.com";
$title = getTitle($url_og);
echo $title;
?>
</body>
</html> 
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
$doc = new DOMDocument();
@$doc->loadHTMLFile('https://net-raft.com/');
$xpath = new DOMXPath($doc);
echo $xpath->query('//title')->item(0)->nodeValue."\n";
?>
</body>
</html> 
The most helpful PHP solutions
detect browser phpPHP Click to see more ... 4.6K 408