Jump to content

Table


al3x8730

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/122462-table/
Share on other sites

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>';
?>

Link to comment
https://forums.phpfreaks.com/topic/122462-table/#findComment-632387
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.