Hi all,
I have a html file on my server so it is a local file. I would like to get the value of every second <td> in each <tr>
as I said it is a local html file and is written as
<table border="1" style="font-size:90%; text-align:center; margin: 5px;"> <tr> <th>Song title</th> <th>Artist</th> <th>Decade</th> <th>Genre</th> <th>Single / Pack name</th> <th>Release date</th> <th>Family Friendly</th> <th>Additional <i>Rock Band 3</i> Features</th> </tr> <tr><td>"<a href="http://en.wikipedia.org/wiki/Fortunate_Son" title="Fortunate Son">Fortunate Son</a>"<sup id="cite_ref-cover_14-0" class="reference"><a href="#cite_note-cover-14"><span>[</span>a<span>]</span></a></sup></td> <td><a href="http://en.wikipedia.org/wiki/Creedence_Clearwater_Revival" title="Creedence Clearwater Revival">Creedence Clearwater Revival</a></td> <td>1969</td> <td>Southern Rock</td> <td><span style="display:none" class="sortkey">... !</span><span class="sorttext">Single</span></td> <td><span style="display:none" class="sortkey">2007-11-20 !</span><span class="sorttext">Nov. 20, 2007</span></td> <td style="background: #90ff90; color: black; vertical-align: middle; text-align: center;" class="table-yes">Yes</td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">None</td> </tr> <tr><td>"<a href="http://en.wikipedia.org/wiki/Juke_Box_Hero" title="Juke Box Hero">Juke Box Hero</a>"<sup id="cite_ref-cover_14-1" class="reference"><a href="#cite_note-cover-14"><span>[</span>a<span>]</span></a></sup></td> <td><a href="http://en.wikipedia.org/wiki/Foreigner_(band)" title="Foreigner (band)">Foreigner</a></td> <td>1981</td> <td>Classic Rock</td> <td><span style="display:none" class="sortkey">... !</span><span class="sorttext">Single</span></td> <td><span style="display:none" class="sortkey">2007-11-20 !</span><span class="sorttext">Nov. 20, 2007</span></td> <td style="background: #90ff90; color: black; vertical-align: middle; text-align: center;" class="table-yes">Yes</td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">None</td> </tr> <tr><td>"<a href="http://en.wikipedia.org/wiki/Get_It_On_(T._Rex_song)" title="Get It On (T. Rex song)">Bang a Gong</a>"<sup id="cite_ref-cover_14-2" class="reference"><a href="#cite_note-cover-14"><span>[</span>a<span>]</span></a></sup><sup id="cite_ref-scheduled_to_be_removed_august_15-0" class="reference"><a href="#cite_note-scheduled_to_be_removed_august-15"><span>[</span>b<span>]</span></a></sup></td> <td><a href="http://en.wikipedia.org/wiki/T._Rex_(band)" title="T. Rex (band)">T. Rex</a></td> <td>1971</td> <td>Glam</td> <td><span style="display:none" class="sortkey">... !</span><span class="sorttext">Single</span></td> <td><span style="display:none" class="sortkey">2007-11-20 !</span><span class="sorttext">Nov. 20, 2007</span></td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">No</td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">None</td> </tr> <tr><td>"<a href="http://en.wikipedia.org/wiki/My_Sharona" title="My Sharona">My Sharona</a>"<sup id="cite_ref-cover_14-3" class="reference"><a href="#cite_note-cover-14"><span>[</span>a<span>]</span></a></sup></td> <td><span style="display:none" class="sortkey">Knack !</span><span class="sorttext"><a href="http://en.wikipedia.org/wiki/The_Knack" title="The Knack">The Knack</a></span></td> <td>1979</td> <td>Pop-Rock</td> <td><span style="display:none" class="sortkey">... !</span><span class="sorttext">Single</span></td> <td><span style="display:none" class="sortkey">2007-11-20 !</span><span class="sorttext">Nov. 20, 2007</span></td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">No</td> <td style="background: #FFB; color: black; vertical-align: middle; text-align: center;" class="partial table-partial">Pro Guitar/Bass</td> </tr> <tr><td>"<a href="http://en.wikipedia.org/wiki/Cherry_Bomb_(song)" title="Cherry Bomb (song)">Cherry Bomb</a>"<sup id="cite_ref-cover_14-4" class="reference"><a href="#cite_note-cover-14"><span>[</span>a<span>]</span></a></sup></td> <td><span style="display:none" class="sortkey">Runaways !</span><span class="sorttext"><a href="http://en.wikipedia.org/wiki/The_Runaways" title="The Runaways">The Runaways</a></span></td> <td>1976</td> <td>Punk</td> <td><span style="display:none" class="sortkey">... !</span><span class="sorttext">Single</span></td> <td><span style="display:none" class="sortkey">2007-11-20 !</span><span class="sorttext">Nov. 20, 2007</span></td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">No</td> <td style="background:#ff9090; color:black; vertical-align: middle; text-align: center;" class="table-no">None</td> </tr> goes on for another 1100 <tr>'s .........................................
I tried
<?php $url = "rb3_list.html"; $html = new simple_html_dom(); $html = file_get_html($url); foreach($html->find('table tr') as $row) { $cell = $row->find('td', 1); echo $cell; } ?>
but all I get is a blank page.