Zend - The PHP Company




HTML

Add Code


fetchTags  

Type: application
Added by: madlogic
Entered: 04/01/2003
Last modified: 02/12/2002
Rating: - (fewer than 3 votes)
Views: 4284
Fetch the three major tags providing information about the website! ... Retrieves the meta keywords, description, and the title of the page. I was bored and thought it would be interesting.


<?php
function fetchTags($url)
{
  
$array file ($url);
  for (
$i 0$i count($array); $i++)
  {
    if (
ereg("<title>",$array[$i]))
    {
      
$title ereg_replace("n","",strip_tags(strstr($array[$i],"<title>")));
    }
  }
  
$tags get_meta_tags($url,1);
  if (!
$tags)
  {
    
$tags[keywords] = 'n/a';
    
$tags[description] = 'n/a';
  }
  
$tags[title] = $title;
  if (!
$tags[title])
  {
    
$tags[title] = 'n/a';
  }
  return 
$tags;
}
?>


Usage Example




Rate This Script





Search



This Category All Categories