kewley Posted December 8, 2006 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. Link to comment Share on other sites More sharing options...
BrainSmasher Posted December 8, 2006 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. Link to comment Share on other sites More sharing options...
kewley Posted December 8, 2006 Author 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"? Link to comment Share on other sites More sharing options...
BrainSmasher Posted December 9, 2006 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now