Comments (2)
Can you provide a snippet of your code where the incorrect result occurs?
from minecraft-server-status.
Sure.
for ($x = 0; $x < $arrlength; $x++) {
try {
include_once 'MinecraftServer.php';
$server = new MinecraftServer($servers[$x]->qhost, $servers[$x]->qport, 1);
} catch (Exception $e) { }
//var_dump($server->getInfoArray());
$online = $server && $server->online == 1 && $server->hostname;
//generating some html here
}
There's an array of arrays ($servers) that hold the server values. Every check returns a value of online == 1 so I simply added a check for the hostname which was only populated when a server was really online. I've worked around it but I'm reporting the issue so you can fix the underlying cause if you want.
Also, as a side note, I don't know if the library or vanilla php supports more granular timeouts but the minimum 1 second is a really long time when checking local servers. I would prefer to fail out at 50ms or even 25ms so that the page can load faster. The response when the server is up will always come back in less than 1ms and never come back if it's down. Just throwing that out there in case you improve the library.
from minecraft-server-status.
Related Issues (11)
- Players are may not displayed HOT 23
- Cant load SimpleClass Fallback on different root
- Notice: Undefined offset: 1 in /var/www/html/Minecraft-Server/apis/MinecraftServerStatus.class.php on line 77
- Getting error at line 23 and foreach loop for players HOT 2
- Notice: Undefined offset: 1 HOT 2
- 'Failed to write on socket' - Minecraft Status Checker HOT 2
- Online assertion
- Throwing exceptions
- Bug in Zeile12 HOT 3
- Parse error: syntax error, unexpected '[' in /home/u337092315/public_html/MinecraftServerStatus.class.php on line 23 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minecraft-server-status.