Get non-wallet transactions using bitcoin rpc (gettransaction)
Enable txindex=1 in your bitcoin.conf (You'll need to rebuild the database as the transaction index is normally not maintained, start using -reindex to do so), and use the getrawtransaction call to request information about any transaction (it won't work for the genesis block's coinbase transaction though, it's a special case).

Note that this will only give you raw transaction data (you can add a 1 argument after the call to have it decoded instead of in hexadecimal notation), but it cannot know the payment amount or fees, for example.