I am really struggling with this and need some help.
Here is the HTML I am trying to parse into an array:
<div id="container">
<div id="content">
<p class="header"> </p>
<table class="dottedhorizontal" width="100%">
<tr>
<th class="dottedhorizontal" width="140" colspan="4">Gamer Information</th>
<th class="dottedhorizontal center" width="30">Gamer<br />score</th>
<th class="dottedhorizontal center" width="60">Last Seen</th>
<th class="dottedhorizontal" width="*">Last Activity or Game Played </th>
</tr>
<tr>
<td class="dottedhorizontal"><img src="images/icons/status/offline.png" width="16" height="16" alt="offline" title="offline"></td>
<td class="dottedhorizontal center"><img src="http://tiles.xbox.com/tiles/v-/1z/1Gdsb2JhbC9ECFZXVEoAGAFdL3RpbGUvMC8yMTAyMAAAAAAAAAD7XP2f.jpg" height="20" width="20" border="0" alt="Xbox 360 Dashboard" title="Xbox 360 Dashboard" /></td>
<td class="dottedhorizontal"><img src="images/icons/flags/us.png" width="16" height="11" alt="United States" title="United States"></td>
<td class="dottedhorizontal">
<small>
<a href="http://live.xbox.com/member/A 43N15" target="_blank" >A 43N15</a>
</small>
</td>
<td class="dottedhorizontal right"><small>9645</small></td>
<td class="dottedhorizontal center"> </td>
<td class="dottedhorizontal"><small></small></td>
</tr>
<tr>
<td class="dottedhorizontal"><img src="images/icons/status/offline.png" width="16" height="16" alt="offline" title="offline"></td>
<td class="dottedhorizontal center"><img src="http://tiles.xbox.com/tiles/bG/+w/1Wdsb2JhbC9ACgRcBxwAF1EPL3RpbGUvMC8yODAwNAAAAAAAAAD6n29M.jpg" height="20" width="20" border="0" alt="Halo: Combat Evolved" title="Halo: Combat Evolved" /></td>
<td class="dottedhorizontal"><img src="images/icons/flags/au.png" width="16" height="11" alt="Australia" title="Australia"></td>
<td class="dottedhorizontal">
<small>
<a href="http://live.xbox.com/member/a creepy person" target="_blank" >a creepy person</a></small> </td>
<td class="dottedhorizontal right"><small>360</small></td>
<td class="dottedhorizontal center"><small>04/28/2008<br />at 12:48am</small></td>
<td class="dottedhorizontal">Call Of Duty 3<small><br /><small>5 of 26 achievements, 95 of 1000 pts</small></small></td>
</tr>
<tr>
</tr>
</table>
</div>
</div>
What I am trying to parse out into an array is basically everything in the table individually.
For example I tried to preg_match_all
<a href="http://live.xbox.com/member/
get everything until
target="_blank" >
which would return both A 43N15 and a creepy person.
This is what I tried without any luck:
$pattern = '#<a href=\"http://live.xbox.com/member/[^\<]*>.*target=\"_blank\" >#is';
$num_matches = preg_match_all($pattern, $html, $matches);
if ($num_matches == 0) {
echo ' NO MATCHES FOUND';
} else {
echo $num_matches . ' FOUND<br>';
print_r($matches);
}
I hope someone can help me.