943,816 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 475
  • PHP RSS
Aug 11th, 2009
0

fetching metadata of web page

Expand Post »
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
php Syntax (Toggle Plain Text)
  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>
Similar Threads
Reputation Points: 15
Solved Threads: 5
Junior Poster
rohitrohitrohit is offline Offline
120 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Help with image color modification
Next Thread in PHP Forum Timeline: Displaying contact form inputs properly in the email





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC