al3x8730 Posted September 8, 2008 Share Posted September 8, 2008 I have an auto generated list using the cURL function, this is organized within a table. <?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><b><u>Name</u></b></td><td><b><u>Title</u></b></td><td><b><u>Level</u></b></td><td><b><u>Experience</u><b/></td><td><b><u>Gender</u></b></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>'; ?> That works fine. But now I want to add a search feature to it somewhat like this: if (strstr($data, $online)) { echo $online." is online!"; } else { echo $online." is not online."; } Where $online = A user input name. So they can enter a username, and if it's on that auto generated list it will echo $online." is online."; Or not... But I'm having trouble editing the first code so I can get this working. I'm trying to get the echo of the data into a variable $data so then using the search function I can just use what I have posted above. Can anyone help? Link to comment https://forums.phpfreaks.com/topic/123191-searching-an-auto-generated-list/ Share on other sites More sharing options...
Ken2k7 Posted September 8, 2008 Share Posted September 8, 2008 What is $data? Link to comment https://forums.phpfreaks.com/topic/123191-searching-an-auto-generated-list/#findComment-636270 Share on other sites More sharing options...
al3x8730 Posted September 8, 2008 Author Share Posted September 8, 2008 What is $data? I want to make the string of information in the list $data so I can just search that with the search function. Link to comment https://forums.phpfreaks.com/topic/123191-searching-an-auto-generated-list/#findComment-636288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.