function getTitle($url) {$doc = new DOMDocument; // Create a new DOMDocument object in $doc $doc->loadHTML(file_get_contents($url)); // Load the contents of our desired website into $doc$a = $doc->getElementsByTagName("title"); // Get all of the 'a' XHTML tags and there attributes and store in array $areturn $a->item(0)->nodeValue;}

$url="http://www.go4expert.com";
$doc = new DOMDocument; // Create a new DOMDocument object in $doc
$doc->loadHTML(file_get_contents($url)); // Load the contents of our desired website into $doc
$a = $doc->getElementsByTagName("title"); // Get all of the 'a' XHTML tags and there attributes and store in array $a
echo $a->item(0)->nodeValue;