PHP: Find the "SEO Friendly" title in a URL.

Posted October 2nd, 2010


Finds an "SEO Friendly" title placed in the URL after the domain and returns the value.

<?php
function getTitle(){
  $fp = fopen("http://www.example.com","r");
  while (!feof($fp) ){
    $page .= fgets($fp, 4096);
  }
  $title = eregi("(.*)",$page,$regs);
  return $regs[1];
  fclose($fp);
}
?>