OPC UA is a protocol with a fairly large complexity.
You will not able to read something with a few hundred lines of code.
You need a library /toolkit.
If your program is open source may you can use a library from the OPC Foundation, if not then some commercial library can cost some thousand dollar