Get amount of Bitcoins at an address with PHP

bitcoin, coinbase-api, coinbase-php, php

Solution

Hmm, would this work for you:

<?php
function getBalance($address) {
    return file_get_contents('https://blockchain.info/q/addressbalance/'. $address);
}

echo 'Address Balance: ' . getBalance('1EzwoHtiXB4iFwedPr49iywjZn2nnekhoj');

Using the https://blockchain.info/q API.

Problem

I'm using Coinbase, but they don't have an API call to get the amount of Bitcoins per address, but only per account, which is a collection of addresses. Does anyone have an API call for this? I'd prefer to not to reinvent the wheel by setting up my own Bitcoin server/daemon as suggested in this other SO thread: How to check Bitcoin address balance from my application?

Original source