How do you connect to the Bitcoin Client? So I just started writing a rails app that will be an online wallet. I'm looking over the API code examples for connecting to the bitcoin network at https://en.bitcoin.it/wiki/API_reference_(JSON-RPC). 

PHP was the easiest example, seen here 

  require_once 'jsonRPCClient.php';

  $bitcoin = new jsonRPCClient('http://user:password@127.0.0.1:8332/');

  echo "&lt;pre&gt;\n";
  print_r($bitcoin-&gt;getinfo()); echo "\n";
  echo "Received: ".$bitcoin-&gt;getreceivedbylabel("Your Address")."\n";
  echo "&lt;/pre&gt;";


So I'm presuming that it connects to the bitcoin network via a username and password. Couple of questions.

What username/password? I bought bitcoin on coinbase, then exported it to a paper wallet. What user/pass is associated with my bitcoin? I thought it was just public/private key? 

Why port 8332? 

Why 127.0.0.1? Could it be any address?
You need to run either Bitcoin-Qt or bitcoind on your system.  Create a bitcoin.conf file containing the following lines:

rpcuser=your-userid
rpcpassword=your-password
server=1


You can then connect to your bitcoin node by specifying address 127.0.0.1 and port 8332.  Use the userid and password you specified in the bitcoin.conf file.

While it is possible to open port 8332 to allow remote users to connect to the local node, this is not a good idea for security reasons because it allows access to your wallet.  Instead, your users would communicate with your application and your application would then make the necessary RPC calls to the local node.