Jump to content

Load data from another site?


Recommended Posts

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

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...