savj14 Posted May 7, 2014 Share Posted May 7, 2014 I'm trying to parse out TEXT #1 and TEXT #2 from the example below and I'm having issues. I've been using Simple HTML DOM parser but I seem to be missing something. I've tried different combinations like below but again no luck. $url = file_get_html('http://website.com'); $text1 = $url->find('div.ym-gl.headingInnerDiv'); $text2 = $url->find('div.ym-grid.ym-gl'); <div class="ym-gl headingInnerDiv"> <a href="">TEXT #1</a> </div> <div class="ym-grid ym-gl" > <a href=""></a> <p style="font-size: 115%; margin-bottom:0px">TEXT #2</p> </div> Link to comment https://forums.phpfreaks.com/topic/288314-helping-parsing-within-divs/ Share on other sites More sharing options...
savj14 Posted May 8, 2014 Author Share Posted May 8, 2014 Anyone out there? =) Link to comment https://forums.phpfreaks.com/topic/288314-helping-parsing-within-divs/#findComment-1478709 Share on other sites More sharing options...
Ch0cu3r Posted May 8, 2014 Share Posted May 8, 2014 Try $url = file_get_html('http://website.com'); $text1 = $dom->find('div[class="ym-gl headingInnerDiv"] a', 0); $text2 = $dom->find('div[class="ym-grid ym-gl"] p', 0); echo "Text1: {$text1->innertext}<br />Text2: {$text2->innertext}"; Link to comment https://forums.phpfreaks.com/topic/288314-helping-parsing-within-divs/#findComment-1478712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.