/ Published in: PHP
Return URL Title.
Return URL if any problem.
Return URL if any problem.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function get_url_title( $url ){ try{ $doc = new DOMDocument(); @$doc->loadHTMLFile( $url ); $xpath = new DOMXPath( $doc ); $title = $xpath->query( '//title' ); $title = $title->item( 0 ); return $url; } $title = $title->nodeValue; return $title; } return $url; }catch (Exception $e) { return $url; } }