FishSword Posted August 7, 2010 Share Posted August 7, 2010 Hi, How do I open all HTML file contained in a folder, then search for the title of the page, and save the title in the database? Also, is it possible to do this using functions? Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/210069-open-html-file-and-extract-html-content/ Share on other sites More sharing options...
Ruzzas Posted August 7, 2010 Share Posted August 7, 2010 http://php.net/manual/en/function.fopen.php http://php.net/manual/en/function.fread.php http://php.net/manual/en/function.preg-match.php Quote Link to comment https://forums.phpfreaks.com/topic/210069-open-html-file-and-extract-html-content/#findComment-1096310 Share on other sites More sharing options...
wildteen88 Posted August 7, 2010 Share Posted August 7, 2010 Or use the DOM object. $doc = new DOMDocument(); $doc->loadHTMLFile("filename.html"); $xpath = new DOMXPath($doc); $entries = $xpath->query('//html/head/title)'; echo $entries->item(0)->nodeValue; Quote Link to comment https://forums.phpfreaks.com/topic/210069-open-html-file-and-extract-html-content/#findComment-1096326 Share on other sites More sharing options...
PradeepKr Posted August 8, 2010 Share Posted August 8, 2010 Check this for various methods to do it http://www.expertsguide.info/2010/08/parse-xml-or-html/ Quote Link to comment https://forums.phpfreaks.com/topic/210069-open-html-file-and-extract-html-content/#findComment-1096545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.