SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Fdb's Avatar
    Join Date
    Dec 2005
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    get_meta_tags () But the title?

    If I make use of get_meta_tags(), I can get the keywords and description of a web page, anyone know how to get the title of a web page?

  2. #2
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this.

    PHP Code:
            if (preg_match('/<title>(.*)<\/title>/i',$page,$ar)){
                
    $title $ar[1];
            }
                if(empty(
    $tags['title'])){
                if (!empty(
    $tags['title'])){
                    
    $tags['title'] = htmlentities($ar[1]);
                } else {
                    
    $tags['title'] = $title; }
            } 

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Location
    Dundee, Scotland
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://uk.php.net/get_meta_tags have a look at the 2nd comment (was posted by mariano at cricava dot com) or the post by Michael Knapp further down. The have posted functions or snippets of code that can do this.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •