Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = [
- "command" => "login",
- "arguments" => [
- "userId" => my-id,
- "password" => my-password
- ]
- ];
- $in = json_encode($data);
- $service_port = 5124;
- $address = gethostbyname('xapia.x-station.eu');
- $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- if ($socket === false) {
- echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "n";
- }
- $result = socket_connect($socket, $address, $service_port);
- if ($result === false) {
- echo "socket_connect() failed.nReason: ($result) " . socket_strerror(socket_last_error($socket)) . "n";
- }
- socket_write($socket, $in, strlen($in));
- while ($out = socket_read($socket, 2048)) {
- echo $out;
- }
- socket_close($socket);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement