You can get the latest block number over rpc by calling the eth_blockNumber.
Use the following request code:
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
// Result
{
"id":83,
"jsonrpc": "2.0",
"result": "0x4b7" // 1207
}
There are other, higher level APIs that you might be interested in, like web3.js or web3.py. They both allow you to use web3.eth.blockNumber to get the latest block number