Maciek20 Posted March 2, 2008 Share Posted March 2, 2008 I would like to have a script on my website about MMORPG TIBIA. If someone could write script which will show on my website information if player is online/offline I would be thankful. Script would take information about player who I would to see if hes online/offline on my page from there: http://www.tibia.com/community/?subtopic=whoisonline&world=Mythera Thanks for help. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted March 2, 2008 Share Posted March 2, 2008 think you should post this in freelance forum mate http://www.phpfreaks.com/forums/index.php/board,8.0.html Regards Liam Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 2, 2008 Share Posted March 2, 2008 this forum isn't for us to create it for you. If you want someone to do that for you, hire them. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted March 2, 2008 Share Posted March 2, 2008 Since I like some exercise now and then, I wrote it for you. It's pretty simple: You load in the page in question, and check whether the given player name is present or not. <?php $playerName = 'Name here'; $world = 'Mythera'; $url = 'http://www.tibia.com/community/?subtopic=whoisonline&world='.$world; $pageString = file_get_contents($url); if (strpos($pageString, $playerName) !== false) { echo $playerName, ' is online in ', $world, '.'; } else { echo $playerName, ' is offline in ', $world, '.'; } ?> Edit: Be aware that the page we're loading is around 241 KB in size. May take a little while. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted March 2, 2008 Share Posted March 2, 2008 Oops, realized I made some mistakes, this should work as intended: <?php $playerName = 'Name here'; $playerName = str_replace(' ', ' ', $playerName); $world = 'Mythera'; $url = 'http://www.tibia.com/community/?subtopic=whoisonline&world='.$world; $pageString = file_get_contents($url); if (strpos($pageString, '">'.$playerName.'</A>') !== false) { echo $playerName, ' is online in ', $world, '.'; } else { echo $playerName, ' is offline in ', $world, '.'; } ?> Edit: Argh! The forum is wrecking my ampersand on line 2 in the code. It should read $playerName = str_replace(' ', ' ', $playerName); Quote Link to comment Share on other sites More sharing options...
SirChick Posted March 2, 2008 Share Posted March 2, 2008 Oops, realized I made some mistakes, this should work as intended: <?php $playerName = 'Name here'; $playerName = str_replace(' ', '\ ', $playerName); $world = 'Mythera'; $url = 'http://www.tibia.com/community/?subtopic=whoisonline&world='.$world; $pageString = file_get_contents($url); if (strpos($pageString, '">'.$playerName.'</A>') !== false) { echo $playerName, ' is online in ', $world, '.'; } else { echo $playerName, ' is offline in ', $world, '.'; } ?> Ya really shouldn't just make scripts for people who can't be bothered to do it themselves or pay a freelance, because then other people will ask assuming that we will help do the same for them etc. Quote Link to comment Share on other sites More sharing options...
thebadbad Posted March 2, 2008 Share Posted March 2, 2008 I agree that they should go to the freelance forum instead, I was just helping this time. Go away greedy people! Quote Link to comment Share on other sites More sharing options...
corbin Posted March 2, 2008 Share Posted March 2, 2008 While we're complaining about this thread, I also hate vague titles. "Please help me with this." Then again, it got me to click it. Quote Link to comment Share on other sites More sharing options...
SirChick Posted March 2, 2008 Share Posted March 2, 2008 While we're complaining about this thread, I also hate vague titles. "Please help me with this." Then again, it got me to click it. LOL 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.