Decode String

Asked

Viewed 72 times

0

I need to decode a string coming from an external device via PHP.

This equipment is a tracker that emits information in a time interval for a given host and port. I created a socket that reads the same host and port as the tracker and I was able to receive a message. This is the part of the code I’m using to show the received values.

socket_listen($webSocket);

        $buff = @socket_read(socket_accept($webSocket), 1024, PHP_BINARY_READ);
        echo "Numero de dados recebidos: $flgSl \n";

        $receiveStrHex = fread($buff);

        var_dump($receiveStrHex);

Part of the received string: Òyšþøçü À ? 0 ô'P 'R@ Hb U eˆ7Xộž,Òyšþøçü À

I had tried to use the unpack() method but I was also unsuccessful.

Thank you.

  • What is the secret message? is encondig problem?

  • I think it is not a problem, because another software already performed the procedure of reading this type of code.

1 answer

1


This was no coded message.

This string is memory allocation sent by the equipment. To handle the message and be able to work with it, I converted the string to hexadecimal.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.