Author

Topic: How to wait for confirmations blockchain.info API PHP (Read 1279 times)

sr. member
Activity: 364
Merit: 256
You may use $_GET['confirmations'], here is a good example,

Code:
if ($_GET['confirmations'] >= 4) {              // change 4 to whatever number you want
  //Add to the database

  //Delete from pending

  if ($result) {
        echo "*ok*";
  }
} else {
   //Waiting for confirmations
   //create a pending entry

   echo "Waiting for confirmations";
}
newbie
Activity: 13
Merit: 0
newbie
Activity: 13
Merit: 0
Hello everybody

I am use blockchain in my shop for accept bitcoin but i need to wait for 2 block confirmation in php

Now i use a simple copy past in tutorial for test balance

Code:
$cc = @file_get_contents('https://blockchain.info/q/address/'.$address.'/?api_code='.$api_code);
$cc = $cc / 100000000;

if($do['balance'] > $cc) // if balance in blockchain change to 0
{
update
}
else // if deposit
{
                update
        }

Who to use like https://blockchain.info/q/address/'.$address.'/?api_code='.$api_code.'&confirmations=2 ?

Thanks you  Smiley
Jump to: