The online racing simulator
Yes, sorry. But I was still confused even after I found the answer. I thought that it are not seconds, because the script caused the problem again.

I tried to contact the creator, but unfortunately VorTeX3k isn't answering on ICQ, although he authorized me.

But thanks anyway.
Hi,

is there a way to find out via php, if a host is connected to the insim relay and viewable via LFS Remote?
In "getstat2.php?action=hosts" I doesn't find such info.

My intention is to display a host list with a link to lfs remote only where it is accessable.


thx in advance,
paXton
Quote from paXton :Hi,

is there a way to find out via php, if a host is connected to the insim relay and viewable via LFS Remote?
In "getstat2.php?action=hosts" I doesn't find such info.

My intention is to display a host list with a link to lfs remote only where it is accessable.


thx in advance,
paXton

Obtain a list of hosts from the InSim Relay
I need help guys.
Using "pst" action i receive:
157663430
4767155
33346
2045
506
468
363
2835
235
45
44
17
Italy
0
^1R^7eady^32^1R^7oll GT2 Racing
1251054488
631
FXR


There is a way to retrieve this only one ?
^1R^7eady^32^1R^7oll GT2 Racing
Quote from michele0676 :I need help guys.
Using "pst" action i receive:
157663430
4767155
33346
2045
506
468
363
2835
235
45
44
17
Italy
0
^1R^7eady^32^1R^7oll GT2 Racing
1251054488
631
FXR


There is a way to retrieve this only one ?
^1R^7eady^32^1R^7oll GT2 Racing

Not on it's own, no - you'll have to parse that response from LFS World to retrieve only the content that you need. All those elements are separated by line breaks I believe, so it should be a simple case of just splitting it into an array then indexing the element that contains the server name. If you let us know which language you're using, I'm sure someone here can help you out with some code.
Well, I would split the output by new line character and take 15th item. In C# it may basically look like this (I hope I don't have a bug there ):

string host = pst.Split('\n')[14];

Quote from EQ Worry :Well, I would split the output by new line character and take 15th item. In C# it may basically look like this (I hope I don't have a bug there ):

string host = pst.Split('\n')[14];


I did the same in php but there is a problem.
I cannot read, for example, 3 times in 1 sec the same script ...
Yes, if using the LFSW data for free, you are limited to one request per 5 seconds, only then you can receive another set of data. The option is either to use the service as paid one or implement a buffer/queue that would allow sending requests only after 5 seconds.
Quote from michele0676 :
Quote from EQ Worry :Well, I would split the output by new line character and take 15th item. In C# it may basically look like this (I hope I don't have a bug there ):

string host = pst.Split('\n')[14];


I did the same in php but there is a problem.
I cannot read, for example, 3 times in 1 sec the same script ...

I would like to point out that the split function in PHP is deprecated as of PHP 5.3.0, and should no longer be used. It would be better to use the php function explode, as that seems to not be going anywhere, and has a long standing counterpart, implode.

array [b]explode[/b](string [i]$delimiter[/i], string [i]$string[/i][, int [i]$limit[/i]])


<?php 
// Yes, I know this is giving a man a fish.
$host "{$explode("\n"$string)[14]}"
?>

@Dygear
Quote from Dygear :

<?php 
// Yes, I know this is giving a man a fish.
$host "{$explode("\n"$string)[14]}"
?>


Shouldn't it be like this ?

<?php 
$host 
explode("\n"$string14)
?>

Quote from Flame CZE :Shouldn't it be like this ?

<?php 
$host 
explode("\n"$string14)
?>


What I posted is the same as doing this:

<?php 
$array 
explode("\n"$string);
$host $array[14];
?>

But my solution does that in one line
This is a message for those of you who collect racer's countries via the pubstats.

I have updated the country listing that our websites use to be more like the ISO 3166-1 one. More like and not exactly because we don't use only capitals. And there are some added names in our list (england, scotland, etc and kosovo).

But this means that some stored country names have changes as of now. For example 'Slovak Republic' is now 'Slovakia' and 'Russia' is now 'Russian Federation'.
If you store countries, you may have to check their names against the iso list and update them accordingly. Or if for example you display flags you may have to rename some flag files. Most names will have stayed the same though. It's mostly the more exotic names that are slightly different.

I'll attach a php file with the exact array that we use (and a small array with some additional names, not in the ISO list), if that will help a bit.
Attached files
LFSCountriesISOPlus.zip - 2.3 KB - 591 views
Quote from Victor :This is a message for those of you who collect racer's countries via the pubstats.

I have updated the country listing that our websites use to be more like the ISO 3166-1 one. More like and not exactly because we don't use only capitals. And there are some added names in our list (england, scotland, etc and kosovo).

But this means that some stored country names have changes as of now. For example 'Slovak Republic' is now 'Slovakia' and 'Russia' is now 'Russian Federation'.
If you store countries, you may have to check their names against the iso list and update them accordingly. Or if for example you display flags you may have to rename some flag files. Most names will have stayed the same though. It's mostly the more exotic names that are slightly different.

I'll attach a php file with the exact array that we use (and a small array with some additional names, not in the ISO list), if that will help a bit.

Thanks for the update Victor.

Is there any reason why some countries, e.g. COCOS (KEELING) ISLAND, SAINT BARTHÉLEMY have been ignored?

Edit: Also, would it be possible for you to generate empty .txt highlight files for countries which don't yet have any highlights? It would simplify and improve the effectiveness of my code a great deal. Currently, 404'ing on any non-existant highlight files causes quite large delays in my script due to the timeout period.
Just a question, won't it show an error when there's a comma after the last member of an array, like in the two in the file?

<?php 
$ExtraCountriesLFS 
= array (
    
'England',
    
'Northern Ireland',
    
'Scotland',
    
'Wales',
    
'Kosovo',
);
?>

Quote from joshdifabio :Thanks for the update Victor.

Is there any reason why some countries, e.g. COCOS (KEELING) ISLAND, SAINT BARTHÉLEMY have been ignored?

Edit: Also, would it be possible for you to generate empty .txt highlight files for countries which don't yet have any highlights? It would simplify and improve the effectiveness of my code a great deal. Currently, 404'ing on any non-existant highlight files causes quite large delays in my script due to the timeout period.

I may have left those two out by accident. EDIT - ohyeah countries do need to have people living in them and have internet to be listed by us
I'll have a look at touching non-existent files soon.
Quote from Flame CZE :Just a question, won't it show an error when there's a comma after the last member of an array, like in the two in the file?

<?php 
$ExtraCountriesLFS 
= array (
    
'England',
    
'Northern Ireland',
    
'Scotland',
    
'Wales',
    
'Kosovo',
);
?>


Nope, in arrays that last comma is ok
I have updated the php file attached to the earlier post. That list is final I think.

There are a number of LFS accounts that still have a name not in that list, but that's because I don't know what to do with them.
For example there are some accounts with Yugoslavia. I don't know what to convert that into because there is more than 1 possibility. The same with "Serbia and Montenegro" as they are split now.
So I will leave such countries for now and let the user decide for himself the next time he updates his account details (then he's forced to update it).

Also keep in mind there is the 'Other' option and some really old accounts may have no country at all because of programming noobness on my end back then, but pretty much none of those accounts are used anymore.

Also I've created empty highlights files for every country that didn't have one yet.
Is there any way currently of determining what team a racer belongs to, or more importantly, can it be added to the pst request output for the next version?
atm you can use the teams action to get the entire teams list. Hmm I could improve that though.
I'll think about the pst option.
Quote from Victor :atm you can use the teams action to get the entire teams list. Hmm I could improve that though.
I'll think about the pst option.

Hi Victor,

Thanks for considering this. I had contemplated getting the whole team info, but that is a LOT of data to request from the stats site as well as parse.
can I retrieve hotlaps filtered by country, like you can do through LFSworld?

e.g. all hotlaps at BL1 with XRG by Greek drivers?

Thank you in advance and i hope you make sense what i mean
at this time there is no pubstat hotlaps country filter. I could add it for a next version, but that probably won't be very soon.

FGED GREDG RDFGDR GSFDG