It takes 30 seconds to register for an
Inputs.io account. It takes about 5 minutes to start accepting Bitcoin.
Assuming you have an average LAMP (linux apache mysql php) website, with a MySQL database of users and their balances, this script will work for you - name it callback.php and set the full path as your callback:
$mysqli = new mysqli("localhost", "user", "password", "databasename");
$apikey = "my_api_key";
$pin = "1234";
if($_SERVER["REMOTE_ADDR"] == "50.116.37.202"){
if(isset($_GET["note"])){
$note = $mysqli->real_escape_string($_GET["note"]);
$amount = $mysqli->real_escape_string($_GET["amount"]);
$userExistsQ = $mysqli->query("SELECT COUNT(*) FROM users WHERE username='$note'");
if($userExistsQ->fetch_row()[0] === "0"){
// user does not exist. send the coins back
$sendBackTo = urlencode($_GET["from"]);
$returnNote = urlencode("Error: Username not found. Please include exactly your username in the notes field.");
$url = "
https://inputs.io/api?key=$apikey&action=send&address=$sendBackTo&amount={$_GET['amount']}¬e=$returnNote&pin=$pin";
if(substr($note, 0, 7) != "Error: "){
// do not callback error messages
file_get_contents($url);
}
} else {
$mysqli->query("UPDATE users SET balance=balance+$amount WHERE username='$note'");
}
echo "*OK*";
} else {
// Someone sent to our Bitcoin address. This shouldn't happen if we don't post it anywhere.
}
}
For more info, see our API.
https://inputs.io/apiFeel free to ask any questions here or to
support@inputs.io