kewley 0 Posted December 8, 2006 Report Share Posted December 8, 2006 Hi,I have a basic knowledge of PHP (very basic actually, still learning) but I am curious how to load data from another site using it.Example: This page loads the amount of players on a server, located here (Once the page loads click "play RuneScape existing user" and then click "low detail" you will then see the server list). Any help or advice is greatly appreciated. Quote Link to post Share on other sites
BrainSmasher 0 Posted December 8, 2006 Report Share Posted December 8, 2006 <?php$contents = '';$handle = fopen("http://www.runescape.com/lang/en/aff/runescape/serverlist.ws?lores.x=1&plugin=0&order=WMLP","r"); if($handle){ while (!feof($handle)) { $contents .= fread($handle, 8192);} fclose($handle);}function WorldPlayers($world) { $start = strpos($GLOBALS['contents'], 'World '.$world.'<'); if($start == 0){ return 'N/A'; } $str1 = trim(substr($GLOBALS['contents'], $start+strlen($world)+21, 4)); if(Is_Numeric($str1)){ return $str1; } else { return $str1; }} $count = explode('">World ', $contents);for($i=1; $i<=count($count); $i++){ echo $i.'. '.WorldPlayers($i).'<BR>';}?> credits to whoever made this.Found it in my resources. Quote Link to post Share on other sites
kewley 0 Posted December 8, 2006 Author Report Share Posted December 8, 2006 Thanks a lot, I'll start decoding and adapting it in a bit.I'm curious how you manged to get the script, what are your "resources"? Quote Link to post Share on other sites
BrainSmasher 0 Posted December 9, 2006 Report Share Posted December 9, 2006 Thanks a lot, I'll start decoding and adapting it in a bit.I'm curious how you manged to get the script, what are your "resources"?My resources are all the files i have on my computer that written by other people and some written by me.This script is actually simple.It get the data from given link. Looks for world 1, world 2 enz and then it strips the text after it to get the players in the world. Quote Link to post Share on other sites
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.