fetching metadata of web page

Reply

Join Date: Oct 2007
Posts: 46
Reputation: rohitrohitrohit is an unknown quantity at this point 
Solved Threads: 3
rohitrohitrohit's Avatar
rohitrohitrohit rohitrohitrohit is offline Offline
Light Poster

fetching metadata of web page

 
0
  #1
Aug 11th, 2009
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
  1. $url=$_GET['url'];
  2. $url = addslashes($url);
  3. $tags=get_meta_tags($url);//echo $tags;
  4. if (sizeof($tags) == 0){
  5. echo '<tr><td>No META information was found!</td></tr>';
  6. }
  7. else
  8. {
  9.  
  10. if(!$url)
  11. {
  12. //die( "You need to define a URL to process." );
  13. }
  14. else if(substr($url,0,7) != "http://" )
  15. {
  16. $url = "http://$url";
  17. }
  18.  
  19. /* Does this URL already have a record in the page-table? */
  20. $result = mysql_query("SELECT table FROM page WHERE page_url = \"$url\"");
  21. $row = mysql_fetch_array($result);
  22.  
  23. if( $row['page_id'] )
  24. {
  25. /* If yes, use the old page_id: */
  26. $page_id = $row['page_id'];
  27. }
  28. else
  29. {
  30. $desc="";
  31. foreach($tags as $key=>$value)
  32. if($key=="description")
  33. $desc=$value;
  34. mysql_query("INSERT INTO table(page_url,description) VALUES (\"$url\", '".$desc."' )");
  35. $page_id = mysql_insert_id();
  36. }
  37.  
  38. foreach($tags as $key=>$desc)
  39. {
  40. if($key=="keywords")
  41. {
  42. $result = mysql_query("SELECT word_id FROM word WHERE word_word = '$value'");
  43. $row = mysql_fetch_array($result);
  44. if( $row['word_id'] )
  45. {
  46. /* If yes, use the old word_id: */
  47. $word_id = $row['word_id'];
  48. }
  49. else
  50. {
  51. /* If not, create one: */
  52. mysql_query("INSERT INTO table(word_word) VALUES (\"$value\")");
  53. $word_id = mysql_insert_id();
  54. }
  55.  
  56. /* And finally, register the occurrence of the word: */
  57. mysql_query("INSERT INTO table (word_id,page_id) VALUES ($word_id,$page_id)");
  58. // print "Indexing: $cur_word<br>";
  59. }
  60. }
  61. }
Last edited by peter_budo; Aug 11th, 2009 at 2:45 pm. Reason: Please use [code][/code] istead of <code></code>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 218 | Replies: 0
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC