Bitcoin Forum
May 03, 2024, 04:09:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to wait for confirmations blockchain.info API PHP  (Read 1267 times)
pulser (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
July 14, 2014, 01:06:24 AM
Last edit: July 14, 2014, 05:41:20 PM by grue
 #1

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
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714752582
Hero Member
*
Offline Offline

Posts: 1714752582

View Profile Personal Message (Offline)

Ignore
1714752582
Reply with quote  #2

1714752582
Report to moderator
1714752582
Hero Member
*
Offline Offline

Posts: 1714752582

View Profile Personal Message (Offline)

Ignore
1714752582
Reply with quote  #2

1714752582
Report to moderator
pulser (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
July 18, 2014, 06:00:57 PM
 #2

Up  Smiley
arieq
Sr. Member
****
Offline Offline

Activity: 364
Merit: 256


View Profile
July 18, 2014, 09:34:46 PM
 #3

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";
}

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!