Bitcoin Forum

Other => Beginners & Help => Topic started by: WorldOfBitcoin on November 29, 2012, 05:44:08 AM



Title: Bitping API; HTML=POST
Post by: WorldOfBitcoin on November 29, 2012, 05:44:08 AM
I'm drawing a blank on some basic HTML stuff.

Bitping.net API sends a POST. I have a php script set up from twilio that sends a txt any time it is loaded. I have it set on a link now anytime I click it I get a text sent to my cell.

How do set it up so anytime I get a HTML POST from Bitping sent to my page it loads/runs this PHP script?


"from bitping.net "

To get the full benefit of BPN you need to implement the HTTP POST api callback.

We provide a simple example in PHP to receive the events below, please note that the secret value is unique to your account, and should be kept secret.
If you build a module for a webshop, the secret value should be user editable.

When you choose to receive HTTP POST events for a order, we will contact your webserver when a payment has received the required amount of confirmations.
The HTTP POST event will contain the following variables

Code:
 <?php

             $address       
$_POST["to_address"];
              
$amount        $_POST["amount"];
              
$btc           $_POST["btc_amount"];
              
$confirmations $_POST["confirmations"];
              
$txhash        $_POST["txhash"];
              
$block         $_POST["block"];
              
$sig           $_POST["signature"];
              
$mysig sha1(
                
$address .
                
$amount .
                
$confirmations .
                
$txhash .
                
$block .
                
"f632c83ad0f5a44d9a1XXXXXXXXXXXX"
                
);

                if (
$mysig === $sig)
                {
                  
//check if number of confirmations is ok
                  //update order/send user notification
                
} else {
                  
//log all post data, send warning email to administrator
                
}
                   
?>

also;
What is that "$block "f632c83ad0f5a44d9a1XXXXXXXXXXXX"




bitping
https://bitcointalk.org/index.php?topic=55923.0


I can post the twilio php if that helps.
 


Title: Re: Bitping API; HTML=POST
Post by: rex on March 11, 2013, 07:53:31 AM
+1

I have the same question.
first I though this secret should be my account password, but if I use that, the sha1.haxdigest() doesn't match with the signature. What is this exactly?



Title: Re: Bitping API; HTML=POST
Post by: rex on March 11, 2013, 08:05:20 AM
Finally i sort this out. the "secret key" is just the one that on our api page (in the example the site shows to us)