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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.