Code:
$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;
IT didn't worked for me. what is the error here?