How do I query a remote bitcoin node like RPC? I know how to query the blockchain stored on my machine programmatically using bitcoind commands. Is it possible to do the same on a public node?

For example, is it possible to send “getblockcount” over the internet to bitcoinstats.com, hard-coded in the bitcoin source, or to inductivesoul.us, found in the bitcoin.it wiki? What are the steps to do so?

Edit

The quick answer is:


No, you cannot use bitcoind commands.
You have to communicate with a remote node using TCP.
You have to use a different set of commands found in the Protocol Specification.
Excellent question, and welcome to the community!
Short Answer
Maybe.
Long answer
Yes, you can send queries to other nodes on the Bitcoin network. Note that these aren't RPC calls, but Bitcoin's underlying communication protocol. That means that all of the calls will be a little different, and some of them won't exist.
Examples:

There's no equivalent to getblockcount in the underlying protocol. Instead, you can connect to a node and listen for its version message, and look at the start_height field.

Instead of getrawmempool, you use mempool.

Instead of getpeerinfo, you use getaddr.

There's no equivalent to stop, because that would be stupid.


Also, if you're trying to query other nodes on the network, one of these libraries will be very helpful:

Python: http://protocoin.readthedocs.org/en/v0.1/index.html
(Use protocoin.clients.BitcoinClient)
Java: https://bitcoinj.github.io/
(Use Peer.sendMessge)
Go: https://github.com/btcsuite/btcd/blob/master/wire/README.md

(If you're not using one of these languages, leave a comment.)