SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: get_meta_tags () But the title?
-
Jul 19, 2006, 00:05 #1
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?
-
Jul 19, 2006, 00:43 #2
- 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; }
}
-
Jul 19, 2006, 01:09 #3
- 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