The online racing simulator
You can wrap it with a div or something to change the font color, am I right?
You can provide a css file to suit your own needs. If you send it to me I'll make it work for you and let you know how to use it.

(flame, he seems to be doing it via an iframe)
Ah, sorry then
did it with php
Quote :
<?php
$ch = curl_init("http://www.lfsworld.net/hoststatus/?h=IR:team%20race%20server");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>

Quote from IRCheateR :did it with php


<?php 
function get_host_status($hostName) {
    
$c curl_init('http://www.lfsworld.net/hoststatus/?h=' urlencode($hostName));
    
curl_setopt($cCURLOPT_HEADER0);
    
curl_setopt($cCURLOPT_POST1);
    
curl_setopt($cCURLOPT_RETURNTRANSFER1);
    
$return curl_exec($c);
    
curl_close($ch);
    return 
$return;
}
?>

Lol. Why with curl? Will it work with file_get_contents? I think it's faster than curl.
Quote from misiek08 :Lol. Why with curl? Will it work with file_get_contents? I think it's faster than curl.

My LFS World SDK uses both. If file_get_contents is not allowed to go to URLs cURL, if installed, is. (There is no point to having cURL installed if you can't use URL's with it.)
Quote from IRCheateR :did it with php

thx man, it was realy usefull! But I got problem with that, It works fine, but the problem is that I putted code into a php fusion panel, and all tha pages background down for server info is changed to white, instead of original black..I thing there something wrong with footer info, how can I change it?
Quote from Victor :
Hostname URL encoding
If you want to use this feature for a host with weird characters in its name, you must "urlencode" the hostname, which means you must convert these weird characters into a format acceptable for use inside an URL. If you're having problems getting this feature to work because it keeps saying the host is offline, you may want to give the following a try.
To make it easy for you I've created a simple page where you can convert any text into urlencoded text : http://www.lfsworld.net/urlencode.html

I might be dumb(rather noob on this), but I am not able to decode "™DB Private" for some reason, the "™" won't "code"....

And another thing, is the colours(used on server name), critical to make it work?
This is how it works:


<?php 
php
    $server_info 
file_get_contents('http://www.lfsworld.net/hoststatus/?h=' urlencode('™DB Private') . '&hostlink');

    
//echo complete Information from LfS-World
    
echo $server_info;
?>

The result should look like this:

DB Private
Mode S2, Practice
Track Fern Bay Gold Rev
Cars XRG, LX4, LX6, RB4, FXO, XRT, RAC, FZ5, XRR
Settings PSC mp
Version 0.5Z28
Conns 0 / 37

Server colors are not critical as you can see...
-
(felito7) DELETED by felito7
Hi guys,

In advance, I'm sorry if my english is bad.
Your methods works fine with our team server but I have a formating problem.(CSS Properties)

In fact, when you call the LFS Hoststatus Page, he call in background his CSS Style too. (Named default.css // Here : http://www.lfsworld.net/hoststatus/styles/default.css)

This CSS have this proprieties :

div {
font: 11px Verdana;
padding: 0px;
margin: 0px;
}

But i use the Wordpress CMS and the div element is used a little bit everywhere in templates.
Native, i use a 13px font size (Body).

But since i've added Hoststatus, every DIVs on my pages have a 11px font size.

Do you know a solution to solve my problem ?
Thanks


EDIT : I don't want a solution like div { font-size: 13px !important; } in the style.css of my template ... Because .. for example, my div footer with a small font size ... and with this "solution", my footer will have a 13px font size too ^^
You could call the page by appending &onlycontent to the url. So the css wont' be loaded.

http://www.lfsworld.net/hoststatus/?h=[HSK]%20Demo&onlycontent

result:

<?php 
<div class="HostName"><span style="color: #000000;">[H</span><span style="color: #FF0000;">S</span><span style="color: #FFFF00;">K</span><span style="color: #000000;">] Demo</span></div>
<
div id="Mode" class="DataCont"><div class="Field1">Mode</div><div class="Field2">DemoRace 5 laps</div></div>
<
div id="Track" class="DataCont"><div class="Field1">Track</div><div class="Field2">Blackwood GP</div></div>
<
div id="Cars" class="DataCont"><div class="Field1">Cars</div><div class="Field2">FBM</div></div>
<
div id="Settings" class="DataCont"><div class="Field1">Settings</div><div class="Field2"> <i><span title="Joining mid-race is allowed">m</span></i></div></div>

<
div id="Version" class="DataCont"><div class="Field1">Version</div><div class="Field2">0.5Z9</div></div>
<
div id="Conns" class="DataCont"><div class="Field1">Conns</div><div class="Field2">15</div></div>
<
div id="Users" class="DataCont"><div class="Field3"></div></div>
?>

Great ! Thanks KlausAdam !

I just add the CSS of the LFS Hoststatus in my template without the "font: 11px verdana;" propertie and it works great !

Thanks for your rapidity !
-
(Drift King CZ) DELETED by Drift King CZ
Hey folks!

I've been using this recently using file_get_contents() in my scripts.
Up to yesterday it all went very smooth, but now it is extremely "laggy" and takes about 10-25 seconds to display a result, whereas directly opening the link returns a result instantly (as ist was before within the script) ...
So ... what happened?
does include() work any better?
Quote from avetere :I've been using this recently using file_get_contents() in my scripts.
Up to yesterday it all went very smooth, but now it is extremely "laggy" and takes about 10-25 seconds to display a result, whereas directly opening the link returns a result instantly (as ist was before within the script) ...
So ... what happened?

Going to the link is fine from your home connection? Is the server on your home connection? Can you remote shell into your server and see if you can wget the file in a good amount of time?

Quote from bunder9999 :does include() work any better?

Would not think so, as php tends to lock down remote inclusion, even when not in safe mode.
Quote from Dygear :Would not think so, as php tends to lock down remote inclusion, even when not in safe mode.

That's a matter of configuration. With allow_url_fopen and allow_url_include on, remote inclusion is possible. However, this is not recommended and not enabled by default, nor will you find it enabled on any shared hosting service.

As for the issue described, I've tested file_get_contents() on 2 machines, one here at home, one in a datacentre in Germany. The latter is slightly faster, takes 220ms on average to obtain the information from LFSW.
Quote from Dygear :Going to the link is fine from your home connection?

Yes!
Quote :Is the server on your home connection?

No!
Quote : Can you remote shell into your server and see if you can wget the file in a good amount of time?

Just testet it ... wget is extraordinarily slow too.

As a matter of fact, I realized later, that other scripts using file_get_contents() (not getting files from lfsworld) are going into timeout too, so it obviously is NOT a lfsw-problem.

Strangely enough, I didn't change anything to my configuration ... I already contacted my hoster for further investigations.

@morpha: Thanks for testing ... I'd have expected similar values before ... by now it takes nearly half a minute to resolve hostname and send http-request (in wget) ... so there's definitely something very wrong ...
Quote from avetere :@morpha: Thanks for testing ... I'd have expected similar values before ... by now it takes nearly half a minute to resolve hostname and send http-request (in wget) ... so there's definitely something very wrong ...

i can think of two "client-side" reasons for that... crappy DNS server (or local config), or IPV6 being enabled on an IPV4-only network.
Quote from avetere :now it takes nearly half a minute to resolve hostname and send http-request (in wget) ... so there's definitely something very wrong ...

I guess now it's time to track down if it's a DNS issue or something else.

Check this out, but replace Google's DNS IP with your web server's DNS (on the server from the shell) and see if you find any issues from there.
It actually was an issue with our DNS-server (no idea though what it was that let it go into tilt) ... Our hoster switched us over to another one and now everything is fine again.
Thanks guys and sorry for initially blaming lfsw
Quote from KlausAdam :You could call the page by appending &onlycontent to the url. So the css wont' be loaded.

OMG thats just what i needed to fix the stats on my site
#48 - SJB
Could add an option to display the names like "drivername (username)" ?


And what about server status graphics in 2 or 3 sizes like tsviewer.com?
(of course without displaying all the 47 usernames which are connected to the server :razz

Regards, SJB
I don't have playername information, so I can't display that.

As for server graphics, I don't think I'll make those. I'm afraid I don't really see the point.
#50 - SJB
Just wrote a little script to get the hoststatus data into variables:


<?php 
php

set_include_path
(get_include_path() . PATH_SEPARATOR './library/');
require_once 
'JS/Extractor.php';

// insert the name of your server
$hostname "Blackwood XFG XRG";

$url "http://www.lfsworld.net/hoststatus/?h=".urlencode($hostname)."&c=1&onlycontent";

$extractor = new JS_Extractor(file_get_contents($url));
$body $extractor->query("body")->item(0);
$data $body->extract(array("div", array("div|span")));

// to see the array / for debug you can uncomment the following 3 lines
// echo "<pre>";
// print_r($data);
// echo "</pre>";

$host $data[0][0];
$mode $data[1][1];
$track $data[2][1];
$cars $data[3][1];
$settings $data[4][1];
$version $data[5][1];
$conns $data[6][1];
$user $data[7][0];

?>

It uses the JS_Extractor from http://jacksleight.com/old/code

Regards, SJB

FGED GREDG RDFGDR GSFDG