how do I grab title,description and keywords...without get_meta_tags
function??
Asked
Active
Viewed 260 times
0
-
what is the problem with get_meta_tags? – Shakti Singh Jan 13 '11 at 10:32
-
Title, description and keywords of *what*? – Lightness Races in Orbit Jan 13 '11 at 10:34
-
*(related)* [Best Methods to parse HTML](http://stackoverflow.com/questions/3577641/best-methods-to-parse-html/3577662#3577662) – Gordon Jan 13 '11 at 10:46
-
How to extract specific elements from a website gets asked on a daily basis. You should not have difficulties finding an answer with [the search function](http://stackoverflow.com/search?q=DOM+html+[php] "Searches for DOM html [php]"). – Gordon Jan 13 '11 at 13:23
2 Answers
0
An option:
<?php
$database = 'meta_tags.txt';
$meta_db = fopen($database, 'r');
$page = $_SERVER['SCRIPT_NAME'];
$page = substr($page, 1);
while($data = fgetcsv($meta_db, 9000, '|'))
{
if($data[0] == $page)
{
$title = $data[1];
$meta_keywords = $data[2];
$meta_description = $data[3];
}
}
?>
Taken from:

benhowdle89
- 36,900
- 69
- 202
- 331
-
1You've just gone to the third Google result for "php meta tags" and pasted the code, without bothering to notice that it's completely meaningless on its own. – Lightness Races in Orbit Jan 13 '11 at 10:33
-
Wow how did you know that!? amazing. Just trying to help. And i provided a link so he could see full code and its alternative to get_meta_tags... – benhowdle89 Jan 13 '11 at 10:36
-
see I havent done that...after testing various options with meta tags I have seen that for some sites get_meta_tags fucntion taking too long. I am doing a data mining with my 100k website list and when I put it into loops some time one loop is taking more time to complete. this is why and I have read many articles says get_meta_tags delays it so thought will ask for any alternative – mathew Jan 13 '11 at 10:38