Transferring data over tcp network

Good day everyone!

I am building a dedicated server for my game and i have run into a data problem.

I was wondering what the best way is to transfer data (variables and/or classes) over the network?
In the data contains information like Current connected players to the server, available game rooms and more. I have searched a lot on the internet and i see a lot of different things about serialization. but i could not find clear information about how to send objects / variables / classes over a network and keep all these variables synchronized.

I hope somebody can help me.

Friendly greetings!

Well if i were to do it, i would use PHP and UnityEngine.Networking; but this would work good for a simple networking, but if you want like a multiplayer game im not sure if this PHP would be the right choice. Just sharing my idea.