I need to connect to a server. The server is a phone system. It has a Socket server running that I need to connect to. The very first message to the server must be in this format:
<byte_count><Socket_Type><Password><0x00[<AppNAme>0x00]
The two most important ate the Byte_Count and the Socket_Type. From the manufacturer info the:
Byte Count: Indicates the byte count for the data being passed
Socket_Type : Passed as hex 84 (0x84)
The Password and Appname are not needed or required.
So How do I connect using this format?
So far I have this:
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); //make the socket
$connection = socket_connect($socket,'192.168.1.230',4000); //connect to the server
while($data = socket_read($socket,2046,PHP_NORMAL_READ)) //listen for any data, and echo that data out
{
echo $data;
}
Once the connection is made the server will send back call information after some other information. Right now I would be happy to get the records onto the screen to see that I have connected.
My goal is to eventually try to get the recieved data into a MySql database.
Can someone give me a hand here?
Thanks Alot!