Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Show SL grid status on a webpage?

Optimus Paul
Autobot Commander
Join date: 26 Sep 2006
Posts: 6
10-13-2006 04:11
Hiya,

We are getting this site off the ground: www.sloodle.com - to allow teachers to easily integrate Second Life with the open source VLE Moodle.

I would like to write a Moodle (www.moodle.org) block that shows the Grid Status of second life - and was wondering if you could share the PHP code that picks up on the status of the grid?

Something as simple as Grid Status Online/Offline etc would be very handy - this way schools, colleges and universities could add the block to their Moodles so they would know if it's possible to access SL without having to leave their VLE.

Any help is most appreciated.

PS: If SL was integrated with Moodle you'd get instant buy in from loads of schools & colleges & uni's - in the UK over 60% of all colleges use it, there is a whitepaper on how we think the system could work over at www.sloodle.com

Cheers.

Paul.
Jeska Linden
Administrator
Join date: 26 Jul 2004
Posts: 2,388
10-13-2006 14:17
Cool project! You can view the grid status here: http://secondlife.com/status/ - there is a link available at the bottom of every page on the web site.

Eventually we'd like to have a web service to make this easier, but currently you should be able to scrape the information from that page. Also, the web team has said that if we can help make the scraping easier (such as by putting status information in the title of the html), please let us know!
_____________________
"The opportunity to participate in the creation of a new world is really a rare one, and so I hope you cherish it."
- Mitch Kapor on Second Life at the 2006 SLCC
Optimus Paul
Autobot Commander
Join date: 26 Sep 2006
Posts: 6
SL Status in title of HTML - yes please!
10-14-2006 01:58
"Eventually we'd like to have a web service to make this easier, but currently you should be able to scrape the information from that page. Also, the web team has said that if we can help make the scraping easier (such as by putting status information in the title of the html), please let us know!"

Jeska Linden

[left]I got it working!

Needs to be wrapped up as a Moodle block but the php is working.

Here it is for anyone else that wants it - I left the links in to the site where I nabbed the code from...

<?php

// Example script, by Dennis Pallett // http://www.phpit.net/tutorials/screenscrap-rss



// Get page

$url = "http://www.secondlife.com/status";

$data = implode("", file($url));




// Get content items

preg_match_all ("/<h3>;([^`]*?)<\/h3>/", $data, $matches);

echo $matches[0][0];

?>

:)

Thanks a lot - I didn't know it was called "scraping" y'see so didn't know what to search for!

:D
[/left]
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
10-16-2006 13:16
[MERGED] We have an Autobot commander here. :) Thank you Optimus, I'll forward this to our web developers so they can check it out...
_____________________
Jeff Linden
Linden Lab Lifeform
Join date: 28 May 2003
Posts: 79
10-16-2006 15:36
Good job, Optimus!

One note I'd like to suggest is to add some additional error checking.

While scraping is very useful, the chance of the data changing out from underneath your feet is much higher than other types of web development.

In general it's nice to write scraping code that fails gracefully; for example, if you can't read the page or if you don't find any <H3> tags, to simply display "Status unavailable" or a more drastic error message.

The unfortunate observation is that while we don't try to break folks who scrape our pages, we don't have a process in place to communicate who's scraping what, and what change will break what scrapes. Caveat scrape-tor! =)
_____________________
Enhancing your Second Lifetime... one life at a time.