hi all,
i have problem i am fetching meta data information of web page so that on the basis of those information i can put search option to my site.i have populate.php which fetch metadata and store relevant information in mysql.
but when i am running populate.php it's giving me error to me
i have to pass a url with populate.php?url=www.some.com
Warning: get_meta_tags[function.get-meta-tags]: failed to open stream: No such file or directory in
Warning: Invalid argument supplied for foreach() in /home/jaguide/public_html/populate.php on line 40
$url=$_GET['url'];
$url = addslashes($url);
$tags=get_meta_tags($url);//echo $tags;
if (sizeof($tags) == 0){
echo '<tr><td>No META information was found!</td></tr>';
}
else
{
if(!$url)
{
//die( "You need to define a URL to process." );
}
else if(substr($url,0,7) != "http://" )
{
$url = "http://$url";
}
/* Does this URL already have a record in the page-table? */
$result = mysql_query("SELECT table FROM page WHERE page_url = \"$url\"");
$row = mysql_fetch_array($result);
if( $row['page_id'] )
{
/* If yes, use the old page_id: */
$page_id = $row['page_id'];
}
else
{
$desc="";
foreach($tags as $key=>$value)
if($key=="description")
$desc=$value;
mysql_query("INSERT INTO table(page_url,description) VALUES (\"$url\", '".$desc."' )");
$page_id = mysql_insert_id();
}
foreach($tags as $key=>$desc)
{
if($key=="keywords")
{
$result = mysql_query("SELECT word_id FROM word WHERE word_word = '$value'");
$row = mysql_fetch_array($result);
if( $row['word_id'] )
{
/* If yes, use the old word_id: */
$word_id = $row['word_id'];
}
else
{
/* If not, create one: */
mysql_query("INSERT INTO table(word_word) VALUES (\"$value\")");
$word_id = mysql_insert_id();
}
/* And finally, register the occurrence of the word: */
mysql_query("INSERT INTO table (word_id,page_id) VALUES ($word_id,$page_id)");
// print "Indexing: $cur_word<br>";
}
}
}