The online racing simulator
Could you please include split times in the wr action. &splits=true
How to get all information data of the hosts?

In the partial code below shows me only racers and hosts.


<?php 
// parse the data 
while ($x $len) { 
    
$hostname ""
    
$nr_racers 0

    for (
$y=0$y<32$y++) $hostname .= $hostlist[$x++]; 
    
$hostname trim_c_string ($hostname); 

    
$x += 20// skip some host-data 

    
$nr_racers ord ($hostlist[$x++]); 
    for (
$w=0$w<$nr_racers$w++) { 
        
$username ""
        for (
$y=0$y<24$y++) $username .= $hostlist[$x++]; 
        
$users[trim_c_string ($username)] = $hostname
    } 

?>

JS
Quote from jscorrea :How to get all information data of the hosts?

Adapted from Anarchi's LFSW-PPF, I use the following code:

<?php 
function getHost($hostname)
{
    
$rawList = array();

    
$file file_get_contents("http://www.lfsworld.net/pubstat/get_stat2.php?version=1.2&user=" LFS_USER "&pass=" md5(LFS_PASS) . "&action=hosts&c=2&ps=" LFSW_PREMIUM_PUBSTAT);
    if (
isLFSWorldError($file)) return 0;
        
    
$rawList = @gzuncompress($file);

    while(
true)
    {

            
//grab the next chunk of host data
            
$blob substr($rawList$offset53);

            
//If it's less than 53 then it can't be valid
            
if(strlen($blob) == 53)
            {
                
//(Re-)Init tmp arrays to parse into
                
$data $racers = array();

                
//Min len is 53. Parse and advance the offset to the end of this chunk
                
$data unpack('a32hostName/c1serverType/c1majorVersion/c1minorVersion/c1testVersion/c1track/c1config/c1reversed/c1maxPlayers/L1cars/L1rules/c1laps/c1qualifyMins/x2/c1players'$blob);
                
$offset+= 53;

                
//Extract the entire player chunk, split it in to smaller chunks of 24, and explode
                
$racers explode('&'chunk_split(substr($rawList$offset$data['players']*24), 24'&'));
                
//This method always adds an empty entry so just pop it off
                
array_pop($racers);

                
//Trim the guff and advance the offset to the next chunk
                
$racers array_map('rtrim'$racers);
                
$offset += $data['players']*24;

                
/*
                //Laps parsing.

                $data['hours'] = 0;

                //Check if laps are literal
                if($data['laps'] > 100)
                {
                    if($data['laps'] < 191)
                    {
                        //Laps are in 10 step increment range (101-191)
                        $data['laps'] = (($data['laps'] - 100) * 10) + 100;
                    }
                    else
                    {
                        //Laps are hours
                        $data['hours'] = $data['laps'] - 190;
                        $data['laps'] = 0;
                    }
                }
                */
                
                //Formatting
                //Compound the 3 integers that make up the track in to 1 var and dump the excess
                
$data['track'] = $data['track'].$data['config'].$data['reversed'];
                unset(
$data['config'], $data['reversed']);

                
//Put the racers in the output
                
$data['playerNames'] = implode('&',$racers);

                
//Version formatting
                
$data['majorVersion'] /= 10;
                
$data['minorVersion'] = chr($data['minorVersion']);

                if(
$data['hostName']==$hostname) return $data;
            }
            else
            {
                break;
            }
        }
        return 
0;
    
    
}
?>

I'm not sure if it's 100% correct, but it's working for me. I'm only a PHP beginner.

Pascal aka paXton

<?php 
php
function isLFSWorldError($string)
{
    switch(
trim(substr($string050)))
    {
        case 
'Identification is required - http://www.lfsforum.net/showthread.php?t=14480':
        case 
'hl: no hotlaps found':
        case 
'hl: no racer':
        case 
'ch: invalid track':
        case 
'ch: invalid car':
        case 
'pst: no valid username':
        case 
'pb: racer has no pbs':
        case 
'no output':
        case 
'can\'t reload this page that quickly after another':
        case 
'':
            return 
true;
    }
     return 
false;
}
?>

Quote from Dygear :

<?php 
php
function isLFSWorldError($string)
{
    switch(
trim(substr($string050)))
    {
        case 
'Identification is required - http://www.lfsforum.net/showthread.php?t=14480':
        case 
'hl: no hotlaps found':
        case 
'hl: no racer':
        case 
'ch: invalid track':
        case 
'ch: invalid car':
        case 
'pst: no valid username':
        case 
'pb: racer has no pbs':
        case 
'no output':
        case 
'can\'t reload this page that quickly after another':
        case 
'':
            return 
true;
    }
     return 
false;
}
?>


Sorry, for the huge massive bump, but is this still correct for all of the errors that LFSW outputs?

Quote from Victor :seriously, the currently biggest premium pubstat spender spends less than 10 pennies a month. Being concerned about $$$ really is exaggerated.

I wonder who is the biggest spender now ... I would think it would have to be me, what with me giving out my key with the LFSWorldSDK.
I can find these additional error messages :

Invalid Ident-Key
not authed (invalid identkey)
not authed (ip)
Invalid login details provided
No authentication method provided.
You shouldn't flood me! You're locked out for 15 minutes now. DO NOT make your program do its requests as fast as it can, until the tarpit is over...
hl_log is only available since version 1.2 and later

And no you're not the 'biggest spender' There are a number of bigger spenders in fact.
Some counters for December for interest :
2,507,144 requests (~1.74 per second)
41,907.23 MB (~29.73KB/s)
Quote from Dygear :Sorry, for the huge massive bump, but is this still correct for all of the errors that LFSW outputs?

Just noticed the first case can never occur, it's 75 characters and can never match a 50 char string


<?php 
php
function isLFSWorldError($string)
{
    switch(
trim(substr($string0149)))
    {
        case 
'Identification is required - http://www.lfsforum.net/showthread.php?t=14480':
        case 
'hl: no hotlaps found':
        case 
'hl: no racer':
        case 
'ch: invalid track':
        case 
'ch: invalid car':
        case 
'pst: no valid username':
        case 
'pb: racer has no pbs':
        case 
'no output':
        case 
'can\'t reload this page that quickly after another':
        case 
'Invalid Ident-Key':
        case 
'not authed (invalid identkey)':
        case 
'not authed (ip)':
        case 
'Invalid login details provided'
        
case 'No authentication method provided.':
        case 
'You shouldn\'t flood me! You\'re locked out for 15 minutes now. DO NOT make your program do its requests as fast as it can, until the tarpit is over...':
        case 
'hl_log is only available since version 1.2 and later':
        case 
'':
            return 
true;
    }
    return 
false;
}
?>

Quote from morpha :Just noticed the first case can never occur, it's 75 characters and can never match a 50 char string

Yep, feel like a bit of a boob right now . Fixed in my version 1.9.5 might come out sooner then I thought.

FGED GREDG RDFGDR GSFDG