jj20051 Posted August 15, 2008 Share Posted August 15, 2008 Ok. I Want To Create A Script That Will Index Any URL I Type In and Turn The Meta Content Into Variables. How Would I Go About Doing This? Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/ Share on other sites More sharing options...
awpti Posted August 15, 2008 Share Posted August 15, 2008 You would start by learning the basics of PHP. Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617046 Share on other sites More sharing options...
jj20051 Posted August 15, 2008 Author Share Posted August 15, 2008 Ha Ha Ha... I Know The Basics Of PHP I Just Haven't Figured Out How I Would Go About Doing this Problem. I Already Made The First Portion Of The Search Engine Script. ( http://apenex.net ), but I Want To Make An Auto Indexer ATM I Am Manually Adding A Description and A Title and Keywords By Hand. ( Very Time Consuming If I Were To Index 1 Million Pages ) Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617050 Share on other sites More sharing options...
jj20051 Posted August 15, 2008 Author Share Posted August 15, 2008 It Might Be Good If I Could Get Some Genuine Help. ( No More Posts Solely Filled With Sarcasm ) Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617057 Share on other sites More sharing options...
trq Posted August 15, 2008 Share Posted August 15, 2008 You would need to read the page into a string using file_get_contents() then parse that string for meta tags using preg_match(). Something like... <?php $file = file_get_contents('http://foo.com/index.php'); $meta = preg_match('/(<meta name="keywords" content="(.*)" \/>)/i', $file, $matches); print_r($matches); ?> Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617061 Share on other sites More sharing options...
Daguse Posted August 15, 2008 Share Posted August 15, 2008 I know only basic PHP so I can't really give you many details but here we go. First I see you got a form to get the URL. From there your going to need to look at the your going to need to find some way to get the info thats on that site. Most search engines use web crawlers; computers that go to the site and follow all the links and grab the data for you. But another way is to maybe to grab the source of the page. From there you can past that data into form and have it look for key meta tags. This page has <meta name="description" content="Post reply" /> <meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" /> Then your script will take the tags and well, store them. As you can see just by the tags this page is used to Post Replies and is for PHP, MySQL and so one. As for what Aqpti posted, all I can say as make sure to give as much detail as you can so the real pros can help. Helps keep them from getting testy. Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617064 Share on other sites More sharing options...
jj20051 Posted August 15, 2008 Author Share Posted August 15, 2008 Well It Didn't Have An Error In It, but It Didn't Work. It Says Array ( )... Here's The Page: http://apenex.net/123.php Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617073 Share on other sites More sharing options...
trq Posted August 15, 2008 Share Posted August 15, 2008 And your code? Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617080 Share on other sites More sharing options...
jj20051 Posted August 15, 2008 Author Share Posted August 15, 2008 I Tried To Use This ( A modified Version Of Your Code ) <?php $file = file_get_contents('http://phpfreaks.com/index.php'); $meta = preg_match('/(<meta name="keywords" content="(.*)" \/>)/i', $file, $matches); print_r($file); ?> It Worked To An Extent It Displays Just The Content Of The Page ( http://apenex.net/222.php ) If I Could Remove All Links, forms and other HTML content it would be perfect for my purposes. Link to comment https://forums.phpfreaks.com/topic/119768-solved-indexing-using-php/#findComment-617083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.