regex - How can i extract ul tag content and p tag content inside <dd> tag using regular expresstion in php -


i want extract content <dd> tag want take p tag content , ul tag content tried preg_match_all in php take contents inside <dd> in html page nothing html code

<dd style="display: block;">                                     <p>lightweight, comfy , cool - dressy shirt won\'t mind wearing!</p>                                     <ul>                                         <li>made of 100% cotton</li>                                                                 <li>specially treated soft feel</li>                                                               <li>classically styled pointed collar , button front</li>                                                               <li>chest pocket; curved shirttail hem</li>                                                              <li>canvas taping @ inner neck</li>                                                                 <li>imported</li>                                                            </ul>                                       <div id="bvsecondarycustomerratings" style="display:none;margin-left: 15px" class="bvbrowserwebkit"> <div class="bvrrrootelement"> <div class="bvrrratingsummary bvrrsecondaryratingsummary"> <div class="bvrrratingsummary bvrrprimaryratingsummary"><div class="bvrrratingsummarystyle2"><div class="bvrrratingsummarynoreviews"> <div id="bvrrratingsummarynoreviewswriteimagelinkid" class="bvrrratingsummarylink bvrrratingsummarynoreviewswriteimagelink"> <a name="bv_trackingtag_rating_summary_2_writereview_i2613l0022" target="bvframe" href="http://reviews.childrensplace.com/4154/i2613l0022/writereview.htm?format=embedded&amp;campaignid=bv_rating_summary_zero_reviews&amp;sessionparams=__bvsessionparams__&amp;return=http%3a%2f%2fwww.childrensplace.com%2fwebapp%2fwcs%2fstores%2fservlet%2fproduct_10001_10001_-1_1005476_827676_26601%257c72469%257c813599_boy%257coutfits%257cplaid%2520patrol_boy&amp;innerreturn=http%3a%2f%2freviews.childrensplace.com%2f4154%2fi2613l0022%2freviews.htm%3fformat%3dembedded&amp;user=__userid__&amp;authsourcetype=__authtype__&amp;submissionparams=__bvsubmissionparameters__&amp;submissionurl=http%3a%2f%2fwww.childrensplace.com%2fwebapp%2fwcs%2fstores%2fservlet%2ftcpcheckuserauthenticationcmd%3flangid%3d-1%26catalogid%3d10001%26storeid%3d10001"> <img src="http://reviews.childrensplace.com/static/4154/translucent.gif" alt="write review"> </a> </div> <div id="bvrrratingsummarylinkwritefirstid" class="bvrrratingsummarylink bvrrratingsummarylinkwritefirst"> <span class="bvrrratingsummarylinkwritefirstprefix">be first review item.</span> <a name="bv_trackingtag_rating_summary_2_socialbookmarkkaboodle_i2613l0022" target="_blank" class="bvrrsocialbookmarkingsharinglink bvrrsocialbookmarkingsharinglinkkaboodle" onclick="this.href=bvreplacetokensinsocialurl(this.href);window.open(this.href,'','left=0,top=0,width=795,height=700,toolbar=1,location=0,resizable=1,scrollbars=1'); return false;" onfocus="this.href=bvreplacetokensinsocialurl(this.href);" rel="nofollow" href="http://reviews.childrensplace.com/4154/share.htm?site=kaboodle&amp;url=http%3a%2f%2fwww.childrensplace.com%2fwebapp%2fwcs%2fstores%2fservlet%2fproduct_10001_10001_-1_1005476&amp;title=__title__&amp;robot=__robot__&amp;image=http%3a%2f%2fcontent.childrensplace.com%2fwww%2fb%2ftcp%2fimages%2fstyles%2f188410_m.jpg" onmouseover="this.href=bvreplacetokensinsocialurl(this.href);"><img width="16" height="16" class="bvrrsocialbookmarklinkimage" src="http://reviews.childrensplace.com/static/4154/link-kaboodle.gif" alt="kaboodle" title="add kaboodle"></a> </div></div></div></div> </div> </div>                                     <p class="tcp-phrase">big fashion, little prices</p>                                      <div id="product_social_icons" style="height: 20px;">                                                     <div class="social_icon current_social">                                                 <div class="twitter"><iframe scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.1336551279.html#_=1336767195241&amp;count=horizontal&amp;id=twitter-widget-0&amp;lang=en&amp;original_referer=http://www.childrensplace.com/webapp/wcs/stores/servlet/product_10001_10001_-1_1005476&amp;size=m&amp;text=the childrens place - plaid shirt&amp;url=http://www.childrensplace.com/webapp/wcs/stores/servlet/product_10001_10001_-1_1005476" class="twitter-share-button twitter-count-horizontal" style="height: 20px; width: 90px;" title="twitter tweet button"></iframe></div>                                                 <div class="pinterest" id="pin_it">                                                     <iframe scrolling="no" frameborder="0" src="http://pinit-cdn.pinterest.com/pinit.html?url=http://www.childrensplace.com/webapp/wcs/stores/servlet/product_10001_10001_-1_1005476&amp;media=//content.childrensplace.com/www/b/tcp/images/cloudzoom/p/188410_p.jpg&amp;description=plaid shirt&amp;layout=horizontal" style="border: medium none; width: 90px; height: 20px;"></iframe>                                                 </div>                                                 <div class="fb-like-btn" id="fb-root">                                                     <script src="//connect.facebook.net/en_us/all.js#xfbml=1"></script>                                                     <fb:like layout="button_count" show_faces="false" width="90" action="like" font="arial" colorscheme="light" fb-xfbml-state="rendered" class="fb_edge_widget_with_comment fb_iframe_widget"><span style="height: 20px; width: 76px;"><iframe id="f111d3371c" name="f5f7b234c" scrolling="no" style="border: none; overflow: hidden; height: 20px; width: 76px;" title="like content on facebook." class="fb_ltr" src="http://www.facebook.com/plugins/like.php?api_key=&amp;locale=en_us&amp;sdk=joey&amp;channel_url=http%3a%2f%2fstatic.ak.facebook.com%2fconnect%2fxd_arbiter.php%3fversion%3d23%23cb%3df11898a314%26origin%3dhttp%253a%252f%252fwww.childrensplace.com%252ff210aed7%26domain%3dwww.childrensplace.com%26relation%3dparent.parent&amp;href=http%3a%2f%2fwww.childrensplace.com%2fwebapp%2fwcs%2fstores%2fservlet%2fproduct_10001_10001_-1_1005476_827676_26601%257c72469%257c813599_boy%257coutfits%257cplaid%2520patrol_boy&amp;node_type=link&amp;width=90&amp;font=arial&amp;layout=button_count&amp;colorscheme=light&amp;action=like&amp;show_faces=false&amp;extended_social_context=false"></iframe></span></fb:like></div>                                             </div>                                        </div>                                 </dd> 

i googled alot figure out problem tried dom parsing client need regex parsing instead of that..

here answer doesn't tell approach ethically wrong:

$pattern = "/<dd.*?>.*?<p>(.*?)<\/p>.*?<ul>(.*?)<\/ul>/s"; if (preg_match($pattern, $html, $matches)) {     echo "p-tag content: ".$matches[1];     echo "<br>";     echo "ul-tag content: ".$matches[2]; } 

i tested html posted , worked.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -