Comments (3)
Hi,
First, what's the IP you're trying to ping?
Then try adding this on top of the script (right after <?php
):
error_reporting(E_ALL);
ini_set('display_errors', true);
And re-run your script. If an error is shown, please give it me back.
If not, try this in another file:
<?php
echo 'They are both required to be true: ';
var_dump(function_exists('fsockopen'));
var_dump(is_resource(fsockopen("play.onecraft.fr", 25565, $errNo, $errStr, 3)));
And tell me what you got.
from mojangapi.
Hi,
I respond to the place of LEN-studios because I have the same problem.
error_reporting(E_ALL);
ini_set('display_errors', true);
It doesn't show anything special.
echo 'They are both required to be true: ';
var_dump(function_exists('fsockopen'));
var_dump(is_resource(fsockopen("play.onecraft.fr", 25565, $errNo, $errStr, 3)));
I receive : True, True.
In "query" function :
// Send handshake
$data = self::queryWriteData($socket, 0x09);
var_dump($data);
I receive : false, every time.
from mojangapi.
What is your PHP version?
Which server are you trying to query?
Where is your script hosted?
Try to change queryWriteData function:
private static function queryWriteData($socket, $command, $append = '')
{
$command = pack('c*', 0xFE, 0xFD, $command, 0x01, 0x02, 0x03, 0x04) . $append;
$length = strlen($command);
$writeLength = fwrite($socket, $command, $length);
if ($length !== $writeLength) {
var_dump('Wrong length, got:', $writeLength, ', expected:', $length);
return false;
}
$data = fread($socket, 4096);
if ($data === false or strlen($data) < 5 or $data[0] != $command[2]) {
if ($data === false) {
var_dump('Data was false');
} else if (strlen($data) < 5) {
var_dump('Unexpected data length: ', strlen($data));
} else if ($data[0] != $command[2]) {
var_dump('data[0] ≠ command[2], data was:', $data[0], ', command was:', $command[2]);
}
return false;
}
return substr($data, 5);
}
It should print where it failed.
from mojangapi.
Related Issues (15)
- Add composer HOT 1
- Namespacing
- Future Proof? HOT 1
- Mojang api Problems HOT 2
- Cannot get any info from players HOT 1
- Unrelated Issue HOT 1
- could you please grant a permissive license to this? HOT 4
- Cannot find my user HOT 2
- Remove deprecated API status
- Not working HOT 8
- The Mojang authentication system does not work. HOT 1
- Erreur lors de l'utilisation de curl HOT 4
- Can't get server players. HOT 5
- Doesn't work anymore at all HOT 2
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 mojangapi.