dflow Posted December 8, 2010 Share Posted December 8, 2010 im using simple_html_dom.php i want to extract the following html: and number the array key so i will know the location of each <td> and extract the value there: this cell: <TD ALIGN=RIGHT NOWRAP class="ftableline1"> 3.7200 </TD> with this : foreach($html->find('td[class=ftableline1]') as $e) echo $e->innertext . '<br>'; <TR class="ftableline1"> <TD ALIGN=RIGHT NOWRAP class="ftableline1"> 3.7200 </TD> <TD ALIGN=RIGHT NOWRAP class="ftableline1"> 3.5400 </TD> <TD ALIGN=RIGHT NOWRAP class="ftableline1"> 3.6651 </TD> <TD ALIGN=RIGHT NOWRAP class="ftableline1"> 3.5982 </TD> <TD align="right" NOWRAP class="ftableline1"> <A HREF=_matbea=1><IMG SRC="images/tezuga_graphit.gif" WIDTH=15 HEIGHT=15 ALT="Show Graph" BORDER="0"></a><BR> </TD> <TD ALIGN=RIGHT NOWRAP>0.01%</TD> <TD ALIGN=right dir="rtl"> <IMG SRC="images/arrow_up.gif" WIDTH=10 HEIGHT=8 BORDER=0><BR> </TD> <TD align="right" NOWRAP dir="rtl" class="ftableline1"> 3.6316 </TD> <TD align="right" NOWRAP dir="rtl" class="ftableline1"> 1 </TD> <TD ALIGN=RIGHT NOWRAP dir="rtl" class="ftableline1"> <A HREF=_matbea=1> דולר ארה"ב</A><BR> </TD> <TD align="right" NOWRAP dir="rtl" class="ftableline1"> <A href="_matbea=1"><IMG SRC="../../meida/images/f1.gif" HEIGHT=15 WIDTH=21 border=0></A><BR> </TD> <TD ALIGN=center NOWRAP dir="rtl"><INPUT TYPE="Checkbox" VALUE="1" NAME="check" id="check" ></TD> </TR> Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted December 8, 2010 Share Posted December 8, 2010 Not sure I follow, but if that is working for echo, then it's easy to assign to an array: foreach($html->find('td[class=ftableline1]') as $e) { $array[] = $e->innertext; } Quote Link to comment Share on other sites More sharing options...
dflow Posted December 8, 2010 Author Share Posted December 8, 2010 Not sure I follow, but if that is working for echo, then it's easy to assign to an array: foreach($html->find('td[class=ftableline1]') as $e) { $array[] = $e->innertext; } thanks all set Quote Link to comment 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.