SampQuery problem -
Scope25 - 02.09.2014
Hello, i don't know if this goes in this section, if it shouldn't be here please let me know.
I'm having a problem with the SampQuery Api made by StatusRed (
https://sampforum.blast.hk/showthread.php?tid=355574):
I have
fsockopen enabled in a paid web hosting but when i use the API always returns "Server did not respond" and server is
online. I tried with multiple servers but still the same..
API code:
http://pastebin.com/sutxpnJ3
Example code:
http://pastebin.com/rPKw6Dhw
I think the fsockopen isn't connecting correctly to the server but, idk how to solve it.
I would be glad if you could help me.
Thanks for reading,
Scope
EDIT: I also tried with Westie API (nvm, they use same method).
Respuesta: SampQuery problem -
Scope25 - 02.09.2014
I think it's a hosting problem, but i can't find how to solve it :S
I tried this:
PHP код:
<?php
/**
* Let's generate the string needed for the packet.
*/
$sIPAddr = "SAMP SERVER IP"; // IP address of the server
$iPort = SAMP SERVER PORT; // Server port.
$sPacket = ""; // Blank string for packet.
$aIPAddr = explode('.', $sIPAddr); // Exploding the IP addr.
$sPacket .= "SAMP"; // Telling the server it is a SA-MP packet.
$sPacket .= chr($aIPAddr[0]); //
$sPacket .= chr($aIPAddr[1]); //
$sPacket .= chr($aIPAddr[2]); //
$sPacket .= chr($aIPAddr[3]); // Sending off the server IP,
$sPacket .= chr($iPort & 0xFF); //
$sPacket .= chr($iPort >> 8 & 0xFF); // Sending off the server port.
$sPacket .= 'i'; // The opcode that you want to send.
// You can now send this to the server.
/**
* Let's connect now to the server.
*/
$rSocket = fsockopen('udp://'.$sIPAddr, $iPort, $iError, $sError, 2); // Create an active socket.
fwrite($rSocket, $sPacket); // Send the packet to the server.
echo fread($rSocket, 2048); // Get the output from the server
fclose($rSocket); // Close the connection
?>
And the echo didn't write anything.