al3x8730 Posted September 2, 2008 Share Posted September 2, 2008 Well I have this script, that will get me a certain users online list. And It has been organized into a neat way, but I think it would look even better inside of a table. The script is: <?php $test = file_get_contents('http://game.endless-online.com/playerlist.html'); //echo $test; preg_match_all('|<td width="155"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="155"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="50"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="100"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="70"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td>|is',$test, $out); foreach ($out[0] as $k => $v){ echo 'Name: ', $out[1][$k], ', Title: ', $out[2][$k], ', Level ', $out[3][$k], ', Experience: ', $out[4][$k], ', Gender: ',$out[5][$k], "<br />\n"; } ?> How would I make that into a table with the categories at the top? Where would I put the tags around? Quote Link to comment Share on other sites More sharing options...
goocharlton Posted September 3, 2008 Share Posted September 3, 2008 From what I could understand this is what you are looking for: <?php $test = file_get_contents('http://game.endless-online.com/playerlist.html'); //echo $test; preg_match_all('|<td width="155"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="155"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="50"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="100"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td><td width="70"><font face="Arial" size="2" color ="#111111">\s+(.*?)</font>\s+</td>|is',$test, $out); echo '<table><tr><td>Name</td><td>Title</td><td>Level</td><td>Experience</td><td>Gender</td></tr>'; foreach ($out[0] as $k => $v){ echo '<tr><td>', $out[1][$k], '</td><td>', $out[2][$k], '</td><td>', $out[3][$k], '</td><td>', $out[4][$k], '</td><td>',$out[5][$k], "</td></tr>"; } echo '</table>'; ?> 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.