Posted By

Unreal on 02/28/09


Tagged

get page title


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Bluewall
vali29
Roen


Get Page Title


 / Published in: PHP
 

URL: http://www.imben.co.uk

Use this snippet to get a page title using the DOM.

  1. function get_remotetitle($urlpage)
  2. {
  3. $dom = new DOMDocument();
  4.  
  5. if($dom->loadHTMLFile($urlpage)) {
  6.  
  7. $list = $dom->getElementsByTagName("title");
  8. if ($list->length > 0) {
  9. return $list->item(0)->textContent;
  10. }
  11. }
  12. }

Report this snippet  

You need to login to post a comment.