dilbertone Posted December 8, 2010 Share Posted December 8, 2010 Hello dear Community, i need some help with preg_match - i want to optimize the code that allready runs very well! i want to get ony the results - not the overhead of HTML-tags in the result How can i improve the (allready very nice ) code!? <?php $content = file_get_contents("http://schulnetz.nibis.de/db/schulen/schule.php?schulnr=94468&lschb"); var_dump($content); $pattern = '/<td>(.*?)<\/td>/si'; preg_match_all($pattern,$content,$matches); foreach ($matches[1] as $match) { $match = strip_tags($match); $match = trim($match); var_dump($match); } ?> Note: I want to store the results in a database - how to do that!? Each idea and tipp will be greatly appreciated regards db1 Link to comment https://forums.phpfreaks.com/topic/221075-preg_match-runs-very-well-need-to-do-only-a-bit-more-tipp-needed/ Share on other sites More sharing options...
AbraCadaver Posted December 9, 2010 Share Posted December 9, 2010 preg_match_all($pattern, $content, $matches); $matches = array_map('trim', array_map('striptags', $matches[1])); There are plenty of mysql and other PHP turtorials: http://lmgtfy.com/?q=php+mysql+tutorial Link to comment https://forums.phpfreaks.com/topic/221075-preg_match-runs-very-well-need-to-do-only-a-bit-more-tipp-needed/#findComment-1145064 Share on other sites More sharing options...
dilbertone Posted December 10, 2010 Author Share Posted December 10, 2010 hi Shawn many many thanks for all - you are great Thx alot! greetings dilbertone Link to comment https://forums.phpfreaks.com/topic/221075-preg_match-runs-very-well-need-to-do-only-a-bit-more-tipp-needed/#findComment-1145332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.