Find the \"SEO Friendly\" title in a URL.


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. <?php
  2. function getTitle(){
  3. $fp = fopen("http://www.example.com","r");
  4. while (!feof($fp) ){
  5. $page .= fgets($fp, 4096);
  6. }
  7. $title = eregi("<title>(.*)</title>",$page,$regs);
  8. return $regs[1];
  9. fclose($fp);
  10. }
  11. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.