dfz Posted June 17, 2009 Share Posted June 17, 2009 Hi there, I have a static webpage in html. Now I want to extract the content by php so that i will not have to fill in all manually by hand into mysql. The interesting part of my html site is: <div style="margin-bottom:20px; margin-top:10px;">Here is a question?</div> A) Answer 1 <P> <strong>B)</strong> Answer 2 <P> C) Answer 3 <P> D) Aanswer 4 <P> </div> As you can see that page contains one question and up to four possible answers. The one that is correct is highlighted as bold. Now how can I use preg_match_all() or even a better function if you know so that i get an array or 5 variables containing the question and the 4 answers? Any ideas? Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/162573-preg_match_all-extract-content-from-html/ Share on other sites More sharing options...
RussellReal Posted June 17, 2009 Share Posted June 17, 2009 Learn Regular Expressions, I just happen to know Regular Expressions and I just happen to be looking for work. *hint hint* but, you don't really need regular expressions.. you could use substr nd strpos and parse out the inside of the <divs> but I just noticed.. you only have ONE opening div, and TWO closing divs.. that would be hard either way to parse correctly. Again, I'm looking for work *hint* Link to comment https://forums.phpfreaks.com/topic/162573-preg_match_all-extract-content-from-html/#findComment-858044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.